file name GetName.html <html> <body> <FORM METHOD = POST ACTION = "SaveName.jsp"> what is your name? <INPUT TYPE = TEXT NAME=username SIZE= 20> <p><INPUT TYPE= SUBMIT> </FORM> </BODY> </HTML> file name SaveName.jsp <% String name = request.getParameter( "username" ); session.setAttribute( "theName", name ); %> <HTML> <BODY> <A HREF="NextPage.jsp">Continue</A> </BODY> </HTML> file name NextPage.jsp <html> <body> Hello, <%=session.getAttribute("theName") %> </body> </html> when I try to execute , SaveName.jsp is generating the following error message. what is the problem? I am using jswdk. please help. I have included tools.jar in classpath. what could be the problem?
Unhandled error! You might want to consider having an error page to report such errors more gracefully com.sun.jsp.JspException: Compilation failed:Note: sun.tools.javac.Main has been deprecated. work\%3A8080%2Fexamples\SaveName_jsp_1.java:71: Method setAttribute(java.lang.St ring, java.lang.String) not found in interface javax.servlet.http.HttpSession. session.setAttribute( "theName", name ); ^ 1 error, 1 warning at com.sun.jsp.compiler.Main.compile(Main.java:347) at com.sun.jsp.runtime.JspLoader.loadJSP(JspLoader.java:135) at com.sun.jsp.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspS ervlet.java:77) at com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.j ava:87) at com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:218) at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:294) at javax.servlet.http.HttpServlet.service(HttpServlet.java:840) at com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155 ) at com.sun.web.core.Context.handleRequest(Context.java:414) at com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139) HANDLER THREAD PROBLEM: java.net.SocketException: Socket is closed java.net.SocketException: Socket is closed at java.net.Socket.getInputStream(Socket.java:643) at com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:161)
Originally posted by vasudha prabhala: Unhandled error! You might want to consider having an error page to report such errors more gracefully com.sun.jsp.JspException: Compilation failed:Note: sun.tools.javac.Main has been deprecated.
This warning is coming as you might be using Jdk 1.4 version.When executing the JSP for the first time, the engine will first convert the JSP into source code for a servlet and then, (if the engine is written for JDK 1.3), will use sun.tools.javac.Main in order to compile the generated servlet,but code.sun.tools.javac.Main has been deprecated in jdk1.4 so you will have to use appropriate servlet engine (for jdk1.4) or bring back the jdk1.3 version. The error, again, seems to be due to some version mis-match as logic seems to be perfect.Try to checkout the javax.servlet.http.HttpSession.class from ur jar, though that is bit tedious, to see if it contains the method set/getAttribute. -Varun [ January 08, 2003: Message edited by: varun Khanna ]