How about creating a bean (in its simplist form, a Java class with a default
constructor defined) setting up a Vector and/or Hashtable variable, putting
some setters and getters for these two items, and then sticking this bean
into the session before forwarding to the JSP page? The JSP page can then
utilize this bean and you simply make calls to the getters of the bean to
get back the various collections.
Is there something I'm missing here?
Erik Sahl
[EMAIL PROTECTED]
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Pankaj Malviya
> Sent: Tuesday, November 09, 1999 2:33 PM
> To: [EMAIL PROTECTED]
> Subject: JSP vs Servlets - How about this ....
>
>
> All the discussion that is going on about JSP vs Servlet doesn't answer
> following questions:
>
> Many a times in business logic the target page is dependent on
> the contents
> of source page. In these scenario a submit button cannot point to a fixed
> JSP page. What may happen is that submit button may point to a
> servlet where
> decision about the target page is taken and then the page is chained using
> requestDispatcher method.
>
> The submit servlet may use the submitted data to prepare the data
> for target
> page ( It may talk to some application server , pass the request
> and get the
> response data along with name of the target JSP page). Now servlet will
> chain the JSP page to present that data. My question is how the
> servlet can
> pass the prepared data which may be in a Hashtable or Vector to
> the JSP page
> for presentation. This strategy effectively separates the presentation and
> business logic. It also reduces the lines of java code written in
> JSP page.
>
>
> below is the code for chanining
>
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class servletToJsp extends HttpServlet {
>
> public void doGet (HttpServletRequest request,
> HttpServletResponse response) {
>
> try {
>
> getServletConfig().getServletContext().getRequestDispatcher("/jsp/
> jsptoserv/
> target.jsp").forward(request, response);
> } catch (Exception ex) {
> ex.printStackTrace ();
> }
> }
> }
>
> Pankaj
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html