aspose file tools*
The moose likes Struts and the fly likes Struts modules and html:form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts modules and html:form" Watch "Struts modules and html:form" New topic
Author

Struts modules and html:form

Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
I tried to configure my application to use modules, but the html:form tag is failing for some reason. Here's the message I get when I try to go to
http://localhost:9080/contact/noActionInputModifyContact.do

[ServletException in:/contact/tiles/bodyContent/inputModifyContact.jsp] Cannot retrieve mapping for action /inputModifyContact'

Here is my web.xml


Here is my struts-config-contact.xml file excerpt:


Here is my tiles-defs-contact.xml file excerpt:


Here is inputModifyContact.jsp


Can anybody PLEASE help me? I looked all over the net and I can't figure this out!
[ November 23, 2004: Message edited by: Anthony Watson ]

Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Missing a "/" ?


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Nathaniel, I've tried it with and without the / but it prints the same error message.

Somehow, it is looking in the struts-config-public.xml file for the inputModifyContact action mapping even though I am forwarding to inputModifyContact from the noActionInputModifyContact action mapping that is within the struts-config-contact.xml file. I don't know if the public file has somehow been set as a default or what. I currently have nothing at all in the default struts-config.xml file.

Can anyone tell me why Struts is trying to find inputModifyContact in the public config file instead of the contact config file? Thanks.
Sujatha Kumar
Ranch Hand

Joined: Jan 05, 2004
Posts: 134
Hi Watson,

I have two points to highlight

First
=====

<action path="/noActionInputModifyContact" type="us.az.common.action.ClearStatusAction">

<forward name="success" path=".inputModifyContact" />

</action>


Instead of .inputModifyContact it should be /inputModifContact
It applies to all the paths in your struts-config.xml


Second
======
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

This entry is missing in your web.xml

Regards


SCJP,SCWCD,SCBCD,SCEA Part I
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Thanks for the suggestions, Sujatha, but my original problem remains. As far as your comments go 1) I use the . instead of a / to indicate that it is a tile instead of an action mapping. 2) I actually have this servlet mapping in my web.xml, I just didn't paste it in my post.

Can anyone help me? Thanks.
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
I think I have created my tiles-defs-contact.xml file incorrectly. I'm not sure if it is okay to reference pages from multiple modules in a single tiles-defs file. Here is the definition that my .inputModifyContact definition inherits from:



See how all the tiles in the base definition refer to a the public module except for the home.jsp page, which is in the contact module?

What's happening is that my first action (/noActionInputModifyContact) is using the contact module. It forwards to a jsp page that uses the html:form tag. The form tag is looking in the public module to find the action (/inputModifyContact) that it will submit to and it should be looking in the contact module. I think that I made a mistake in my tiles-defs-contact.xml file.

Any suggestions would be GREATLY appreciated. Thanks.
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
I figured it out. When I referenced /public/renderMenu.do in the .base definition, Struts changed the moduleConfig it was using from contact to public. I just had to insert the renderMenu action in my struts-config-contact.xml file and point the tiles-defs-contact.xml file's .base definition to /contact/renderMenu.do and everything worked perfectly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts modules and html:form