hi all,
i need some help on JSP Model 2 architecture.
i have used it for years without problems but now i have a special case
that i have never met.
My app follows the JSPM2 approach of encoding into the request path
the name of the 'Action' class to load.
the request is mapped to a servlet which will decode the Path and find out
which class i have to load.
Now i have a problem with a particular JSP.
the JSP is made so that there are multiple selectable lists that are dependent, meaning
that when a value 'A' is selected in one of them, the value of the other must change
depending
on 'A''.
Main function of the JSP is to allow the user to enter some data and submit it to an
action class
(let's call it CreateAction) that will populate a database with the values entered (it
is the JSP with
selectable lists).
I opted for the options of submitting the form to the page itself (i can control where
to submit with JavaScript),
and put at the beginning
<jsp:include pate="LoadSelectableList.myservlet" />
which will populate the request or the session with the proper values.
when the button 'create' will be called, i will submit the request to the
CreateAction.myservlet instead.
Other option that i have is to submit always the request to a CreateAction class, that
in turn will call
LoadSelectableListAction to load teh list and then return the control to the jsp.
Now, the problem with jsp:include is that t he Path loaded is the Path of the JSP in
which there
is the instruction <jsp:include>, and so it cannot be mapped to an Action class.
the option 1 seems more 'clean' to me, since i load selectable componet with an
instruction, but it
has the drawback that i cannot map the ActionClass from the request, and so i have to
handle
only one special case that says 'if the request contains .jsp, then load the
LoadSelectableListAction'.
the option 2 is easier, because i submit the form all the time, but i call the
LoadSelectableListAction
thru another class (CreateAction) that has nothing to do with loading selectable list
components.
Can any of u give me his/her opinion on which approach to follow? if anyone has a
third one, they're
welcome too....
thanx in advance and regards
marco
==========================================================================To
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com