• 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

null action form in pre processing action

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am currently converting a poorly written web app to use struts and i've run into a small problem.
I have a page with 4 links on it. These links are all linked to global forwards in the struts config, which forward onto the appropriate action which then forwards to the correct page.
My problem is that one of the links is forwarding to an action that pre processes a pages content, stores that data in the action form associated with it, and then forwards the request to the 'success' page (the page whose content was processed by the action).
The original page with the 4 links on it, does not have a form and is only a menu type page. So what is happening is that this pre processing action is receiving a null form b/c there isn't a form associated with the global forward.
So my question is, does anyone know how to use a global forward, that forwards to an action that requires an action form to store the display data on the success page?
I considered instantiating the action form myself and placing it in the request, with the name i specified in the struts config, but that seems like a hacked up way of solving this problem.
Does anyone have any ideas??
Thanks,
Dave
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
to be honest i think that doesn't really make sense. Why do you want to forward to an action which processes data and not deliver the data ?
In my opinion it only would make sense to forward to the jsp with the input form.

Originally posted by Dave Knipp:
Hi,
I am currently converting a poorly written web app to use struts and i've run into a small problem.
I have a page with 4 links on it. These links are all linked to global forwards in the struts config, which forward onto the appropriate action which then forwards to the correct page.
My problem is that one of the links is forwarding to an action that pre processes a pages content, stores that data in the action form associated with it, and then forwards the request to the 'success' page (the page whose content was processed by the action).
The original page with the 4 links on it, does not have a form and is only a menu type page. So what is happening is that this pre processing action is receiving a null form b/c there isn't a form associated with the global forward.
So my question is, does anyone know how to use a global forward, that forwards to an action that requires an action form to store the display data on the success page?
I considered instantiating the action form myself and placing it in the request, with the name i specified in the struts config, but that seems like a hacked up way of solving this problem.
Does anyone have any ideas??
Thanks,
Dave

 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The page that i'm forwarding to doesnt require any input from the previous page. I'm just using the action form to store the data that will be displayed on the 'success' page.
The page was previously full of code and scriptlets so i pulled all that code out into an action. This action sets up all the data that the page needs to display and puts that data in the action form. Therefore the page won't contain anymore scriptlets and should be ready to submit onto another page.
I could just store the page's data in a different bean and then put that bean in the request, but isnt that what the action form is for? It's supposed to be used as a bean to hold the form data, so how are you supposed to do any pre processing on a page that has a form and requires that the form has information already present when it is linked to?
This seems like a weakness of struts in my opinion, so that's why i was curious if anyone knew a better way to implement this then, placing objects in scopes.
Dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic