Hi - I'm fairly new to Struts. I thought I understood the configuration setup, but I guess not.
Before I started the project, the form forwarded to only one ActionForm. I am giving the form more functionality, and would like to put the new functionality into a different ActionForm class, since the logic is not similar.
I have entered a new forward tag in the global-forwards section, as well as a new action tag in action-mappings section of the struts-config file. I literally copy & pasted the old ones, & copy & pasted the new name in all places that held the old name. This new name is the same (copy & pasted) as the form's action value I mentioned above.
The only way I can get my new ActionForm class to be called is if I revert back to the original configuration and simply replace the old class name with my new one. Other than that, I get nothing - no error, no stack trace, and no page.
I've reverted back to just hard-coding my new action in the jsp:
Here's the except from the struts-config file:
Not much to go on, but maybe someone can see the error I've made?
Do you understand the concept of Struts (the MVC-approach)? I'm not a Struts wiz either but as far as I know (from the little experience I have) your Form should represent the fields of your jsp page. So if you want to add functionality to your jsp by adding new fields then just extend your form with the field attributes. If you really want a jsp with same sort of fields doing different things, then just implement a new action-form-jsp. Your form should only contain the jsp attributes it represents and the logic should be present (or called from) within your action.
Joined: May 07, 2001
Not adding new fields. Adding functionality based on user choices from existing fields.
Turns out I've done it correctly - just missed a step in a little-used permissions table in the database.
...another case in favor of DOCUMENTING CODE that others may alter!!!