Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Request

 
santhosh kumar vk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to actually share the request object between contexts or would a simple redirect do the trick for you?
 
santhosh kumar vk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sharing request object how to send from one context to another context
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without single container its not possible but you can use request parameter in URL to getting do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic