• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on JSP

 
kishore chitturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How can one application jsp page include another application jsp page?
is it possible?if possible can any body tell me?

regards
kishore
 
chowdary Thammineedi
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you could use the

pageContext.getServletContext().getContext(String URI);

Note that the URI must start with a leading / which is interpreted as relative to the root of the container.

pageContext is an implicit object available to every JSP page. Use this to get to the ServletContext object. Then use the ServletContext to get to any other context available in the container.

Then use this context to get a request dispatcher for the page you want to include.

Any thing WRONG with the above answer. I need approval fron Bassam Zahid (who recently passed SCWCD) and Jose Esteban.
 
chowdary Thammineedi
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BTW Kishore
I haven't tested it? It's getting late though(12.58 AM ET) and I'm Be---rd UP. I will test it tommorow morning and give you the code, if it is possible to do it the way that I proposed.
Can somebody (on the west coast) try it, if possible. Please!
 
Jose Esteban
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by chowdary Thammineedi:
I guess you could use the

pageContext.getServletContext().getContext(String URI);

Note that the URI must start with a leading / which is interpreted as relative to the root of the container.

It should work fine, Thammineedi.

I can only add that "another" way to do the same thing is to use the <c:import> action, which (simplified) syntax is:

<c:import url="url" context="context"/>

As you said, "url" must also start with a leading /.

Originally posted by chowdary Thammineedi:
I need approval fron Bassam Zahid (who recently passed SCWCD) and Jose Esteban.

Come on! You don't need the approval of anybody to help people
 
Sar Lolla
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While it is correct to use

we can also use Is this not correct? Every JSP page has access to ServletContext object via the implicit object applicaiton.

Please correct me if I am wrong....
[ April 12, 2005: Message edited by: Sar Lolla ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic