You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Milo Hyson <mi...@cyberlifelabs.com> on 2003/01/26 07:58:34 UTC
JSP cannot call an action in its own module
I've scanned the list here and found that many people seem to be having
this same problem, so I'm going to add to it. I have a simple
application with two modules, declared in the web.xml as follows:
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/trackers</param-name>
<param-value>/WEB-INF/trackers/struts-config.xml</param-value>
</init-param>
The sub-module config file (/WEB-INF/trackers/struts-config.xml)
contains the following action mapping:
<action path="/create"
type="com.cyberlifelabs.issuetracker.trackers.CreateAction"
name="createTrackerForm" input="/create.jsp" validate="false">
<forward name="success" path="/profiles/create.jsp"
contextRelative="true"/>
</action>
I have a JSP page called /trackers/create.jsp with the following tag:
<html:form action="create.do" focus="name">
Whenever I try to access the JSP, I get the following error:
[ServletException in:create-body.jsp] Cannot retrieve mapping for action
/create'
If I copy the action mapping into the default module
(/WEB-INF/struts-config.xml), it works fine. No matter what value I
enter into the html:form tag (including those beginning with trackers/),
it always seems to look in the default module. I haven't looked at the
source, but if I had to guess I'd say the JSP engine isn't aware of
sub-modules.
--
Milo Hyson
CyberLife Labs
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: JSP cannot call an action in its own module
Posted by Milo Hyson <mi...@cyberlifelabs.com>.
An FYI for all those who have written in with this problem. It seems
that the available documentation isn't clear enough with regards to JSPs
in multi-module applications. The Struts developers have confirmed that
all JSPs must be called from actions and not directly in order for the
ModuleConfig information to be present. I'll admit this is rather crude
and annoying, but that's the way it is.
- Milo Hyson
CyberLife Labs
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
[PATCH] Re: JSP cannot call an action in its own module
Posted by Milo Hyson <mi...@cyberlifelabs.com>.
David M. Karr wrote:
>>>>>>"Milo" == Milo Hyson <mi...@cyberlifelabs.com> writes:
>>>>>>
>>>>>>
>
> Milo> I've scanned the list here and found that many people seem to be having
> Milo> this same problem, so I'm going to add to it. I have a simple
> Milo> application with two modules, declared in the web.xml as follows:
>
> Milo> If I copy the action mapping into the default module
> Milo> (/WEB-INF/struts-config.xml), it works fine. No matter what value I
> Milo> enter into the html:form tag (including those beginning with trackers/),
> Milo> it always seems to look in the default module. I haven't looked at the
> Milo> source, but if I had to guess I'd say the JSP engine isn't aware of sub-modules.
>
>if you can't find any answer here, please submit a detailed bug report about
>this. It would be best if you could provide an isolated test case and put the
>entire build of it in a zip file, and attach it as an attachment to the bug
>report.
>
>If you want to do more analysis on this, try to execute your test case in a
>debugger and step through your action code, and the Struts framework code, to
>see if you can see where it is going wrong. If you see anything in that,
>detail that in your bug report.
>
>
>
I've reported this to Bugzilla and it has been assigned #16442. I've
also taken the liberty of solving the problem and developing a patch, as
follows:
--- RequestUtils.java.orig Sun Jan 26 14:09:31 2003
+++ RequestUtils.java Sun Jan 26 14:32:56 2003
@@ -1673,6 +1673,7 @@
* @since 1.1b3
*/
public static ModuleConfig getModuleConfig(PageContext pageContext) {
+
selectModule((HttpServletRequest)pageContext.getRequest(),pageContext.getServletContext());
ModuleConfig moduleConfig =
(ModuleConfig)
pageContext.getRequest().getAttribute(Globals.MODULE_KEY);
if (moduleConfig == null) { // Backwards compatibility hack
Apply this to src/share/org/apache/struts/util/RequestUtils.java and
recompile Struts to fix the issue.
- Milo Hyson
CyberLife Labs
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: JSP cannot call an action in its own module
Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Milo" == Milo Hyson <mi...@cyberlifelabs.com> writes:
Milo> I've scanned the list here and found that many people seem to be having
Milo> this same problem, so I'm going to add to it. I have a simple
Milo> application with two modules, declared in the web.xml as follows:
Milo> If I copy the action mapping into the default module
Milo> (/WEB-INF/struts-config.xml), it works fine. No matter what value I
Milo> enter into the html:form tag (including those beginning with trackers/),
Milo> it always seems to look in the default module. I haven't looked at the
Milo> source, but if I had to guess I'd say the JSP engine isn't aware of sub-modules.
if you can't find any answer here, please submit a detailed bug report about
this. It would be best if you could provide an isolated test case and put the
entire build of it in a zip file, and attach it as an attachment to the bug
report.
If you want to do more analysis on this, try to execute your test case in a
debugger and step through your action code, and the Struts framework code, to
see if you can see where it is going wrong. If you see anything in that,
detail that in your bug report.
--
===================================================================
David M. Karr ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net ; SCJP; SCWCD
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>