My article "Understanding JSP Model 2 architecture" in this
month's issue of Javaworld may be helpful. Please see:
http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html
Govind
Greg Hodges wrote:
>
> Hi all,
>
> I need help understanding and implementing the Model-2 Architecture advocated by
>folks like Craig.
>
> What I would really like someone to describe is the how, and more importantly the
>where of implementing the Model-2 Architecture. I'll attempt to describe a
>"HelloWorld-ish" application I created to use Model-2 techniques as I understand them.
>
> Let's say I have a jsp page called userinfo.jsp. userinfo.jsp exist in a folder
>called myapp on the root of my webserver. So it would be accessed like
>http://servername/myapp/userinfo.jsp. Now, I have two Java classes: StoreUser, which
>is the "controller" servlet and UserBean which is a Bean which holds info entered in
>the form on userinfo.jsp. Finally, I have another jsp page called showinfo.jsp whose
>purpose in life is to display info. stored in the UserBean.
>
> Now, userinfo.jsp "calls" the StoreUser servlet(<FORM action="/myapp/StoreUser">).
>StoreUser creates a session, a UserBean, and attempts to store the UserBean in the
>session. Then StoreUser forwards the request to showinfo.jsp--
>
> RequestDispatcher rd=getServletContext().getRequestDispatcher("/myapp/showinfo.jsp");
>
> Next, in showinfo.jsp I have the following at the top of showinfo.jsp:
>
> <%@ page session="true" import="learn.UserBean" %>
> <jsp:useBean id="idBean" scope="session" class="learn.UserBean" />
>
> Finally in showinfo.jsp I have a line like:
> <%= idBean.getUserID() %>
>
> I mapped /myapp/StoreUser to the StoreUser servlet, which exist in directory
>structure of my servlet container, JRun.
>
> I'm sure I've done a number of things incorrectly, but my biggest source of
>confusion is how do I get the jsp files that exists under the directory structure of
>my webserver to know about the session created by the StoreUser servlet which exist
>under the directory structure of JRun.
>
> I simply don't know where to place all the directories and files so that they
>"share" the same context, session, etc.
>
> I would appreciate as much info./example code/example dir. structures as anyone is
>willing to provide.
>
> Thanks,
>
> Greg
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
--
Govind Seshadri <[EMAIL PROTECTED]>
jGuru.com - Your Gateway to the Java Universe
http://www.jguru.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html