• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Action to Action Forward

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Im having a SearchForItem Action witch runs on SearchCriteriaForm and provides the results for a itemList.jsp.

Now the list contains a Link for every 'available' item wich leads to a RequestForItem Action.

When the RequestForItem Action is done I jump back to the list again.

Since it's a bigger concurrent system my idea was to store the SearchCriteriaForm in the session context and then forward from the RequestForItem Action to the SearchForItem Action to update the result(list) since the call of RequestForItem Action itself changed my system as well as other users could have.

I want to save the user the trouble of entering all search criteria again, simply refetch from the DB and redisplay the changed list. And of course reuse my SearchForItem Action code, why implement it a second time.

But it doesn't seem to work.





and of course in RequestForItem:
ActionForward af = null;
...
af = mapping.findForward("/search");


Any hints?
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I would probably remove the "/" from the name attribute, but I don't know if that will make a difference. Your path attribute should include ".do", like "/search.do".

- Brent
 
O. Thoms
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, the slash is OK. The application runs fine so far.

I skipped the framework info: It's in a Portlet container and all the .do forwarding renaming blabla is done by the framework.

The Forward "/search" works fine in the MenuAction...

But I solved the problem in a more elegant way anyhow.

I switched to a cleaner, more layered design and removed the search implementation from the Action in a 'Command' using the Command Pattern.

Action just takes JSP input, calls commands and get's results

Now executing the new search is just a single line of code issuing the SearchCommand again.

Sometimes it pays of to build a clean architecture..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic