struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Rood <>
Subject Re: Defining request parameters in action-fowards (or an alternative)
Date Thu, 24 Jul 2003 20:06:08 GMT
I'm interested in other solutions to this as well.

My current solution to the same problem is to store key information in 
the session and use that in conjunction with information from the url.  
So, using your example, you would store the merchant id in the session 
as soon as the user begins working on a particular merchant.  Then, 
after adding a new item, the action would forward to a "display 
merchant" action, which would retrieve the merchant id from the session 
*if* it was not passed with the url.

If the user opens more then one browser window and begins working with 2 
different merchants, it gets tricky because they will potentially share 
the session, but I think you can take care of that with hidden form 
fields.  (ie. if the merchant id hidden in the item form differs from 
the merchantid in the session, warn user to stop working in multiple 

Hope this helps.

Gino LV. Ledesma wrote:

>I've tried browsing and searching the mail archives on how
>to implement this but have not turned up anything useful.
>I've written a Struts-based webapp (coupled with EJB) and
>am applying some finishing touches to it. I have a number
>of forums that, upon submission, will lead to another page.
>This other page, however, is a result of a dynamic lookup
>which the action servlet populates, and a requirement for
>this page to be generated is a certain request identifier.
>To clarify this, say I have two simple objects called
>Merchant and Items, of which Merchant can sell one or more
>items. If I display the merchant's page, I get to see a
>list of items sold by this particular merchant. Now the
>merchant's page has a link that says "Create new Item",
>which contains a form that, when submitted, will go to the
>merchant's page now showing an updated list with the new
>item. However, for the merchant page to be displayed (which
>is handled by the action servlet), it would need to know
>the merchant's id.
>Is there a way to do more flexible (conditional/parametric)
>customization of the action forwards? Or what is the
>proper, if any, way of implementing this? I have several
>pages with similar dependencies (due to the OO/relational
>design), and it can get very tiring to have to navigate
>deeper into a hierarchy just to repeat an action.
>In trying to follow MVC, I try to route all requests
>through controller servlets, so the webapp has very little
>direct links to JSP pages. These controller servlets,
>however, need certain information in generating certain
>pages (in the case above, a merchant's id to display
>information about that merchant).
>Help on the matter is greatly appreciated. These are minor
>things which I'd like to cover prior to releasing our web
>app. Thanks. :)
>Gino Ledesma
> // Programmer's Excuse #4: You can't use that version on
>your system.
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message