Hello friends
I have very small doubt. I am giving you the following code where it is possible for me to instantite one
servlet from another one if this is possible why we require
.
The code is working fine(I am using Weblogic 6.1).
Login.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<form method="post" action="http://localhost:7001/LoginServlet">
Enter your UserName:<INPUT TYPE="text" NAME="user"><br>
Enter your Password :<INPUT TYPE="password" NAME="pass"><br>
<INPUT TYPE="submit" value="Sign-Up">
</form>
</BODY>
</HTML>
LoginServlet.java SessionServlet.java [code]
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class SessionServlet extends HttpServlet
{
protected void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
HttpSession session=request.getSession(false);
String username=(String)session.getAttribute("User");
String password=(String)session.getAttribute("Password");
String code=request.getParameter("Name");
out.println("<html>");
out.println("<head>");
out.println("<title> Servlet 1");
out.println("</title>");
out.println("</head>");
out.println("<body>");
out.println("Your Name is: "+username);
out.println("Your Password is" +"********");
out.println("Your Code is " + code);
out.println("</body>");
out.println("</html>");
}
}
[code]