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)