Passing values from Servlet to JSP
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pragati_Chaurasia
Posted On:   Thursday, July 6, 2006 02:52 AM

Hello All,


I m trying to show the value of the textbox from Servlet to some textbox in JSP.In jsp it is done using "request.getParameter". But in servlet how to pass the value of one textbox into the textbox of JSP.Plz help me......

Re: Passing values from Servlet to JSP

Posted By:   Anonymous  
Posted On:   Thursday, July 6, 2006 09:26 AM

In Servlet Use ......

String text = //get from textbox..


request.setAttribute("textbox", text);

request.getRequestDispatcher("The_JSP_URL.jsp").include(request, response);

------------------------------

In JSP use

String text = request.getAttribute("textbox");

Re: Passing values from Servlet to JSP

Posted By:   Anonymous  
Posted On:   Thursday, July 6, 2006 05:17 AM


Can use request or session ...


To stablish values :
request.setAttribute("name", ...);
session.setAttribute("name" , ...)

To retrieve values :
request.getAttribute("nameOfRequestedAtt");
session.getAttribute("nameOfSessionAtt")

About | Sitemap | Contact