This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Regarding Request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Regarding Request" Watch "Regarding Request" New topic
Author

Regarding Request

santhosh kumar vk
Ranch Hand

Joined: Aug 25, 2009
Posts: 144
hi,

how to send a request from one context to another context by using jsp or servlet can you help me.


Thanking you.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Are you trying to actually share the request object between contexts or would a simple redirect do the trick for you?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
santhosh kumar vk
Ranch Hand

Joined: Aug 25, 2009
Posts: 144
I am sharing request object how to send from one context to another context
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Look at:
http://download.oracle.com/docs/cd/E17477_01/javaee/1.4/api/javax/servlet/ServletContext.html#getContext(java.lang.String) to get a handle to the other context.

Then look at http://download.oracle.com/docs/cd/E17477_01/javaee/1.4/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String) which is used to forward request.

Note: The servlet spec (last I read it) is not very clear on all the specifics of cross context communication so the specific implementation details tend to vary from container to container. Also, what I've posted will not work if the two contexts are not in the same container on the same machine.
Alpesh Padra
Ranch Hand

Joined: Jan 10, 2010
Posts: 41
Without single container its not possible but you can use request parameter in URL to getting do.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Regarding Request
 
Similar Threads
Working with JSP & Servlet paths
Servlet css file location
JSP tags (JSTL) and request Attributes
Calling a method in object outside of your scope
Response attribute?