aspose file tools*
The moose likes Servlets and the fly likes Include in Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Include in Servlets" Watch "Include in Servlets" New topic
Author

Include in Servlets

Subbu Viswanathan
Greenhorn

Joined: May 15, 2001
Posts: 8
I have many JSP pages. Each page includes a Login Validation JSP page that would verify the user's idle time. If the user is idle for more than 5 minutes, he will be forced to login again.
I have a Servlet, that is called from one of the JSP's. How can the Login Validation JSP page be included in the Servlet?
eg.,
These are the files that I have
A.JSP, LoginValidate.JSP and Servlet1
A.JSP
-----
.....
.....
<%@include file = "LoginValidate.jsp"%>
.....
How can the same jsp page be included in Servlet1?
Any suggestions please.
Thanks
Cynthia Yao
Ranch Hand

Joined: Nov 06, 2000
Posts: 92
use requestdispatch.include, check the servlet api for details
Poornima Shetty
Greenhorn

Joined: Dec 12, 2000
Posts: 26
you can use the requestdispatcher to include any jsp along with the request and response object as below:
getServletConfig().getServletContext().getRequestDispatcher("/directory/jspname that you want to include").include(request,response);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Include in Servlets