Mike LaBudde <[EMAIL PROTECTED]>


 >>I would think not, because how is the controller servlet going to pass the
 >>right forwarding URL to each action? I mean, what if the logic of one action
 >>class may forward to many different pages depending on the outcome of the
 >>logic? I would think the forwarding page should be defined or figured out in
 >>the action class, EJB, whatever is doing the logic. An example would
 >>be..what if you needed to go to a different page based on a STATE drop-down
 >>on a form. Each state has its own page. The controller servlet I guess could
 >>read this in from an XML file..but I think this is "logic" that shouldn't be
 >>done in the controller servlet.
 >
>I was thinking that under normal circumstances there would be one (and only
>one) preferred next page. (The use case modelling "Happy Days" (primary)
>scenario.) All that you say is true and none of that would be prevented by
>specifying a preferred next page. Again, my goal here was to make things
>more configurable, rather than embedding application flow logic within a
>compiled Action class. Hmmmh, I can see that I'll have to give this whole
>area a lot more thought. Comments, anyone, on how you do this?

In our approach, every Action is a "ConfigurableAction", linked to the
properties loaded from the XML file.
Actions may have a "target" which is their preferred next page. The target is
defined in the XML file.
Actions may also use specific URLs. Those URLs are defined in properties in the
XML configuration file.

By e.g.,, my SecurityAction may lead to /security/loginOK.jsp or to
/security/loginAgain.jsp. Those URL are handled as properties "LOGIN_VALIDE_URL"
and "LOGIN_UNVALIDE_URL" loaded from the XML file.

So, we don't have any hard coded URL in our java code.


At 3/28/2000 08:59 AM +0200, Daniel Lopez wrote:
<snip, snip>

>  In my case, I added some more
>complexity in here because, as I want my controller servlet to handle
>various applications, I store a hastable per application. I choose the
>appropriate application depending on the suffix.
>So "Enroll.do", I first get the application corresponding to the ".do"
>suffix and then I got the action factory corresponding to the "Enroll"
>operation from the selected application. Then I get the action from the
>factory.

We do something alike :

All our applications use the same sevlet class (ControllerServlet) with a
different configuration file.
The application is defined by a mapping between a path and a servlet.
That is /myapp leads to servlet MyApp.
The servlet MyApp is defined in the web server as linked to class
ControllerServlet and the full path of the configuration is given as init
parameter. The mappings and links are handled by the server so we don't have to
bother about that.

Then for each request, we get the action to perform from the first parameter in
the URL (we call it the "event").

By e.g., our URL request for the myapp application may be :
     /myapp?event=submitAddress

Then I (too) get the action from the factory.

Hope this helps.

And thank you to everyone for this very interesting discussion. I learn a lot.
Arnaud.


--

Les données et renseignements contenus dans ce message sont personnels,
confidentiels et secrets. Ce message est adressé à l'individu ou l'entité dont
les coordonnées figurent ci-dessus. Si vous n'êtes pas le bon destinataire, nous
vous demandons de ne pas lire, copier, utiliser ou divulguer cette
communication. Nous vous prions de notifier cette erreur à l'expéditeur et
d'effacer immediatement cette communication de votre système.

The information contained in this message is privileged, confidential, and
protected from disclosure. This message is intended for the individual or entity
adressed herein. If you are not the intended recipient, please do not read,
copy, use or disclose this communication to others ;also please notify the
sender by replying to this message, and then delete it from your system.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to