[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Servlets and JSP



Attach the String to the request and forward the request with the RequestDispatcher
 
//inside doGet method of servlet
String myString = "Hello";
request.setAttribute("greeting",myString);
RequestDispatcher dispatcher = ServletContext.getRequestDispatcher("greeting_page.jsp");
dispatcher.forward(request, response);
 
 
 
// this will be on the JSP page
 
String greeting = (String) request.getAttribute("greeting");
 
 
Hope this helps
Lance England
www.gr.com

 
-----Original Message-----
From: Deron Pardue [mailto:dpardue@dspin.com]
Sent: Friday, August 03, 2001 10:01 AM
To: ajug-members@ajug.org
Subject: Servlets and JSP

Can anyone help me out with the following?  I need to transfer control from a servlet to a JSP, I have a String in the servlet that needs to be available in the JSP.  I remember reading that this is possible, but I can't find an example of how to do it.
 
Thanks!
 
Deron Pardue