Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts modules - html:form can't find action

 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using struts 1.1 (on Websphere 5.1.1), I'm trying to create struts *modules*.
I ran into the following problem: the <html:form> tag fails to find the module-specific action. It *does* work fine with normal (non-struts) HTML forms.
Could anyone please advise what I'm doing wrong ?

Steps I've taken:
1. Created a strutes module called "module1", with config file "struts-module1.xml".
It has an action mapping:


3. Now, this form (normal HTML) works fine !


4. But the equivalen struts html:form fails (error message:
Cannot retrieve mapping for action /add):


Could anyone please advise ?
Thanks very much.
 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, the last for was of course "add" rather than "addEmployee":

<html:form action="/add" ...>
 
Ambily G Nair
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have to give config file name as struts-config.xml instead of struts-module1.xml

Ambily
 
Nischal Tanna
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes very true... its compulsory!!!
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The config file can be named chicken-little.xml if it is defined in the web.xml properly. It doesn't matter.

The reason why it can not find the action is that Struts can only think in one module at a time. If you do not specify a different module, it will assume that you mean to stay in the same module. If you've never specified a module, it sticks with the default module. I believe that if you include the module name in your html:form action attribute, it will solve the issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic