File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts modules - html:form can't find action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts modules - html:form can Watch "Struts modules - html:form can New topic

Struts modules - html:form can't find action

Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
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

Joined: Nov 13, 2002
Posts: 311
Sorry, the last for was of course "add" rather than "addEmployee":

<html:form action="/add" ...>
Ambily G Nair

Joined: Aug 21, 2004
Posts: 28
I think you have to give config file name as struts-config.xml instead of struts-module1.xml

Nischal Tanna
Ranch Hand

Joined: Aug 19, 2003
Posts: 182
Yes very true... its compulsory!!!

Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

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.

A good workman is known by his tools.
I agree. Here's the link:
subject: Struts modules - html:form can't find action
It's not a secret anymore!