servlets

lost in deployment: session.getAttribute() returns NULL in some Tomcat configurations

此生再无相见时 提交于 2020-01-17 02:19:45
问题 I am experiencing several issues that I can't understand from the first glances. The story is pretty simple, but I guess that the solution is behind some real configuration/deployment problem(s)/inconsistencies. I have defined a JSP and two servlets. The JSP puts something in the session and the servlets are supposed to fetch the data and to manipulate it. The main symptom is that the servlets do not see the session data, when seeing JSPs in Chrome and Firefox. Interesting, that the JSP

execute a jsp program on background of a running java program

烈酒焚心 提交于 2020-01-17 01:30:13
问题 I just want execute my jsp program when a button on my running java program is clicked, it doesn't need to be visible, the jsp program i am saying is for printing and once it is loaded in the browser it will just pop up the print dialog confirm box, so again it doesn't need to be visible, once the button in my java program is clicked the print dialog will just pop up and that's it. By the way i am new here in this site, and also know only basics of java, so i do not have any idea how to do it

I am trying to get checked values from a form contained in a servlet to another servlet. How to do this?

北城以北 提交于 2020-01-16 23:46:10
问题 Here is my servlet that contains the form. try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con1 = null; con1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/itcomplaintsystem", "root", "colbiecaillat"); Statement stmt = con1.createStatement(); ResultSet rs = stmt.executeQuery("select * FROM complaints"); out.println("<form action='assignedc1' method='post'>"); out.println("<table cellspacing='0' width='100%' border=1 width=50% height=50%>"); out.println("<tr>

I am trying to get checked values from a form contained in a servlet to another servlet. How to do this?

谁都会走 提交于 2020-01-16 23:44:07
问题 Here is my servlet that contains the form. try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con1 = null; con1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/itcomplaintsystem", "root", "colbiecaillat"); Statement stmt = con1.createStatement(); ResultSet rs = stmt.executeQuery("select * FROM complaints"); out.println("<form action='assignedc1' method='post'>"); out.println("<table cellspacing='0' width='100%' border=1 width=50% height=50%>"); out.println("<tr>

Using both GET and POST

折月煮酒 提交于 2020-01-16 19:59:11
问题 I'm new to jsp/ajax as you can see. In a jsp/ajax file uploading webpage ,POST is used to upload the file and GET is used to get the uploading progress(with ajax). In doPost() file uploading(it should be "downloading" in server side?)is done and progress listener is set. In doGet() response XML is wriitten(ajax HttpRequest is GET). HTML tags written in response in doPost() is not shown in the browser.Redirection is also not working in doPost(). I can't do any of above in the doGet() since it

Generate PDF file in an appropriate format

*爱你&永不变心* 提交于 2020-01-16 19:48:29
问题 For my use, I created a PDF file using flying-saucer library. It was a legacy HTML so I cleaned out the XHTML using HTMLCleaner library. After this I serialize the XML as string then pass it to the iText module of flying-saucer to render it and subsequently create the PDF. This PDF I place it in the OutputStream . After the response is committed I get a dialog asking to save or open it. However it does not get saved as PDF file. I have to right-click and open it in Adobe or any PDF reader.

NoClassDefFoundError: com/google/api/client/extensions/appengine/http/UrlFetchTransport?

坚强是说给别人听的谎言 提交于 2020-01-16 18:40:33
问题 I have a web service on google app engine and I am trying to read a file from the google cloud store from the web service. This is the code I am using: public static byte[] readFile2(String bucket, String filepath) throws IOException { GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance()); GcsFilename fileName = new GcsFilename(bucket, filepath); logger.warning(fileName.toString() + "<br>"); logger.warning(String.format("/gs/%s/%s", fileName

java.lang.StackOverflowError being thrown by class that doesn't exist

笑着哭i 提交于 2020-01-16 15:45:30
问题 I'm getting the following error in my IDE when trying to deploy my application. The error goes on for 50 pages so I only attached the most significant part below and a little more at the bottom of this post. The error makes sense but the class throwing it doesn't exist. Error Message Apr 25, 2013 12:10:45 AM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet HomeController threw exception java.lang.StackOverflowError Problem: What is strange is that I

How to access `ServletContext` from within a Vaadin 14 app?

白昼怎懂夜的黑 提交于 2020-01-16 13:05:26
问题 I am asking the same as the Question, How to access ServletContext from within a Vaadin 7 app?, but for Vaadin 14. In Vaadin 7, Vaadin provided the simple and handy call: ServletContext servletContext = VaadinServlet.getCurrent().getServletContext(); That particular call is no longer there on VaadinServlet in Vaadin 14. ➥ Is there an equivalent somewhere else in the Vaadin API? My end goal is to use the key-value "attribute" collection to keep references to my app-wide objects. 回答1: Methods

How to access `ServletContext` from within a Vaadin 14 app?

放肆的年华 提交于 2020-01-16 13:05:23
问题 I am asking the same as the Question, How to access ServletContext from within a Vaadin 7 app?, but for Vaadin 14. In Vaadin 7, Vaadin provided the simple and handy call: ServletContext servletContext = VaadinServlet.getCurrent().getServletContext(); That particular call is no longer there on VaadinServlet in Vaadin 14. ➥ Is there an equivalent somewhere else in the Vaadin API? My end goal is to use the key-value "attribute" collection to keep references to my app-wide objects. 回答1: Methods