• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question on JSP

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic