Is there any way to set the value to the input attribute of action tag in struts-config.xml from ActionForm and Action classes.
I see setInput method in ActionMapping class and I thought I can use that method to set the input value from the class. But I get java.lang.IllegalStateException: Configuration is frozen Exception
I have a simple requirement where I have a JSP with a listing that have radio buttons to update/delete from the list and add button to add to the list.
Instead of writing 3 action classes for each form action, I thought of using Dispatch action. It is because I need to validate the form fields, and validation varies for Add/Update/Delete and upon validation errors, the UI should navigate to the previous page, I need to set the what the input page is in ActionForm class..
Please suggest me a solution for this..
Thank you very much in advance and it is kind of urgent. Thank you
If the declarative manner doesn't work for you, you can always do the saveErrors() way and then forward to the correct view from within the execute() of your action. It kinda screws with declarative validation though ... just a thought.
Marc Peabody In case of Add action, I will be going to the Entry form and when user submits that form, I need to do the validation. As I am using the same Action form, upon validation error, it navigates me back to the listing but not entry form and it should because that is what configured in input attribute of action tag. Hence I was trying to upadate the input attribute by calling ActionMapping.setInput() method.
But I learned that struts configuration will be stored in the application config and as it is shared throughout the application, it will not allow you to update these parameters at runtime.
May I have to try what Nathaniel Stoddard is suggesting.
I will try and let you know.
Thank you for you response. They were helpful.
Joined: Nov 17, 2004
It worked but I am not sure if this is the correct approach.
I have set validate="false" in strus-config.xml file.
from action class i am calling validate manually and checking for ActionErrors. If ActionErrors is not equals to null then I am forwarding to the entry page and it worked.
Please let me know if you find a better solution for this.