• 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

Struts modules - html:form can't find action

 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, the last for was of course "add" rather than "addEmployee":

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

Ambily
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes very true... its compulsory!!!
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic