This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet to JSP communication

 
Sanjay, Lalwani
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
Is there any one who has solved problem of communicating info from servlet to jsp.
Cheers
Sanjay
 
Poornima Shetty
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats it that you would like to know?
 
Glenn Proctor
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on the detail of your application, you can probably use the session object.
G.
 
vikinsa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is not much diffrenece in what you do for servlet-servlet communication and the servlet-jsp communication. Only thing you need to consider is the path and the port.
Originally posted by Sanjay, Lalwani:
HI
Is there any one who has solved problem of communicating info from servlet to jsp.
Cheers
Sanjay


------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
 
Melissa Rabin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struggling with this a few weeks ago myself (being the greenhorn of servlets that I am), i learned that there are several tasks involved in communicating jsp info to a servlet:
1. Access web data through the request object of a servlet. Strings can be retrieved through get/setParameter, and objects via get/setAttribute(). Add/manipulate them via your session context object when in the servlet doPost method.
2. Don't forget, if you use servlets in your web apps you need to provide a declaration and mapping for them in your web deployment descriptor (your web.xml). This is a twofold task of declaring the servlet (and its class package) in the <servlet> element, and mapping the servlet to a url pattern (i.e. the initiating jsp) in the <servlet-mapping> element. Your web app container should provide ample info on the details.
3. Include the tag
<form name = "ServletName" action="/ServletName" method = "POST">
and you will be ready to go!
Hope this helps!
Melissa
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic