tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Holt <Je...@vetsmart.com>
Subject RE: <jsp:useBean ...> from a servlet
Date Fri, 12 May 2000 19:11:21 GMT
OK I got mine working from help of Ed Dunkle. I have the following code
snippits, direct from working code:


Servlet:

public void doPost( HttpServletRequest request,
                      HttpServletResponse response)
                        throws ServletException, IOException {
    response.setContentType("text/html");
    
    if( request.getParameter( "addClient" ).equals( "fromJSP" )) {
      Client myClient = new Client( request, conn );

      request.setAttribute( "myClient", myClient );
      request.setAttribute( "testJeff", "Crap" );
      
      RequestDispatcher rd = getServletContext()
                              .getRequestDispatcher( "/viewClient.jsp");
      rd.forward( request, response );
    }

JSP:

<%@ page %>
<HTML>
<HEAD>
<TITLE>
Client Viewer
</TITLE>
</HEAD>
<BODY>
<H2>The following output is from JSP code:</H2>
<P>

<BR>
<jsp:useBean id="myClient" type="vetsmart.Client" scope="request" />

  <%= myClient.get( "firstname" ) %>
<BR>

</P>

<jsp:include page="debug.jsp"  flush="true" />

</BODY>
</HTML>


Hope this helps. Note case of useBean...

Jeff


Mime
View raw message