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

RE: Servlets and JSP



Probably the simplest way is to have your servlet create an HttpSession and store your string in it. Then you can get it back out.
 
in the servlet:
        HttpSession session = request.getSession();
        session.setAttribute("myString", myString);  // might be setValue depending on your version of the JSDK
in the jsp:
     <%
        // do this part if theres a possibility your string could be null, else page will print null
        String myString = "";
        if (session.getAttribute("myString") != null)
        {
          myString = (String)session.getAttribute("myString");
        }
      %>
 
      <%=myMessage%>
-----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