This will/may work with the JSDK2.1, but it doesn't appear to be a method
within JDSK2.0 (HttpRequest.setAttribute) - at least I didn't see it
browsing through Sun's API literature.  I've never used the setAttribute
method, so I don't know too much about it.

If you can stand to place objects into your servlet engine's session, I
think that a good place to do it.  Plus, if you are indeed using JSP pages,
you can make use of the Java bean architecture.  If you can't, and are using
JSDK2.1, maybe setting the attribute in the Request object is a decent way
of doing it (?)  One thing to keep in mind here is that (according to the
documentation, anyway), you could come into conflict when adding keys that
are JDK specific (like javax.*, java.* libraries).


                                                                                Erik 
Sahl
                                                                                
[EMAIL PROTECTED]


> -----Original Message-----
> From: Pankaj Malviya [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 09, 1999 3:35 PM
> To: 'Erik Sahl'; [EMAIL PROTECTED]
> Subject: RE: JSP vs Servlets - How about this ....
>
>
> How about using setAttribute on Request interface and putting the Vector
> into it.
> This will remove the need of a bean and will not require the page to be
> session enabled.
>
> Pankaj
>
> -----Original Message-----
> From: Erik Sahl [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 09, 1999 2:30 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: JSP vs Servlets - How about this ....
>
>
> 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

Reply via email to