Results 1 to 1 of 1
- 08-07-2011, 09:32 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 1
- Rep Power
- 0
servlet include method copying sorce code and executing source code as output how to
the following code the include method is copying target html file source code into response and displaying out put that html file source code how to resolve this problem anyone help me...
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class Sessionsrv1 extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
PrintWriter out=res.getWriter();
HttpSession hs=req.getSession();
if(hs.isNew())
{
out.println("New Session got created"+hs.getId());
}
else
{
out.println("with existing session id:"+hs.getId());
}
String name=req.getParameter("uname");
String value=req.getParameter("uvalue");
//hs.setAttribute(name,value);
hs.setAttribute(name,value);
hs.setMaxInactiveInterval(120);
RequestDispatcher rd=req.getRequestDispatcher("/Signin.html");
rd.include(req,res);
}
Similar Threads
-
Simple servlet not working : entire source code posted
By rahulb in forum Java ServletReplies: 0Last Post: 05-24-2011, 08:50 AM -
Help required in executing the following code
By vivekdarshan in forum Advanced JavaReplies: 0Last Post: 01-23-2011, 10:34 AM -
What will be output by the following code? using trim method.
By racewithferrari in forum New To JavaReplies: 4Last Post: 11-17-2009, 10:40 PM -
MavenJava - browse source code of all open source projects online
By jirkacelak in forum Java SoftwareReplies: 1Last Post: 11-28-2008, 07:27 PM -
Executing Ant code pragramatically
By MikeO in forum Advanced JavaReplies: 0Last Post: 07-24-2007, 10:34 PM
Bookmarks