Here is the code to use RD:
public void doGet(HttpServletRequest req,
HttpServletResponse res) throws ServletException,
IOException {
res.setContentType("text/html");
ServletContext context = getServletContext();
ServletOutputStream out = res.getOutputStream();
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/some.html");
if (dispatcher != null)
try {
out.println("Here is the content: ");
dispatcher.include(req, res);
out.println("Done.");
} catch (Exception e) {}
else
res.sendError(res.SC_NO_CONTENT);
}
Here is the code Test.java for HttpSession :
public void doGet(HttpServletRequest req,
HttpServletResponse res) throws ServletException,
IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
HttpSession session = req.getSession(true);
//session.setMaxInactiveInterval(300);
out.println("Msg: " +
session.getLastAccessedTime()+ "|"+session.getId());
if(session.getValue("pig") == null){
session.putValue("pig",Boolean.TRUE);
out.println("<html>");
out.println("<body>First time to display.<a
href=\"Test\">Go Back</a></center>");
out.println("</body>");
out.println("</html>");
out.close();
}else{
session.removeValue("pig");
out.println("<html>");
out.println("<body>");
out.println("Second time");
out.println("<br>");
out.println("</body>");
out.println("</html>");
out.close();
}
}
--- Nic Ferrier <[EMAIL PROTECTED]> wrote:
> >>> Jen <[EMAIL PROTECTED]> 30-May-00 8:48:04 PM >>>
>
> >Thanks. I am using Oracle Application Server as web
> >server (both http and https) and servlet engine.
> Any
> >experience with it? Also when I use HttpSession, it
> >always returns back "Session Expired" message. Is
> it
> >so bad or it's because config.
>
> Sounds either like your code is completly wrong or
> the servlet engine
> isn't working properly.
>
> If you post an *abridged* (ie: just the basics of
> what you're trying
> to do) version of your code then I will look at
> it...
>
>
> Nic
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help:
http://www.lsoft.com/manuals/user/user.html
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html