You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nikolaus Rumm <ni...@chello.at> on 2000/11/06 22:56:07 UTC

forwarding with

Hello,

I can't forward to another action. I tried...

<struts:link forward="createUser">link</struts:link>
<struts:link forward="createUser.do">link</struts:link>
<struts:link forward="/createUser">link</struts:link>
<struts:link forward="/createUser.do">link</struts:link>

...but the resulting exception always looks like this:

javax.servlet.ServletException: Cannot locate global forwarding for {0}
	java.lang.Throwable(java.lang.String)
	java.lang.Exception(java.lang.String)
	javax.servlet.ServletException(java.lang.Throwable)
	void org.apache.jasper.runtime.PageContextImpl.handlePageException(java.lang.Exception)
	void _0002flogon_0002ejsplogon_jsp_25._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
......

The relevant section from action.xml looks like this:

  <!-- create user -->
  <action    path="/createUser"
      actionClass="com.dolores.client.participant.CreateUserAction"
    formAttribute="userForm"
        formClass="com.dolores.client.participant.UserForm"
        inputForm="/user.jsp">        
    <forward name="success"    path="/user.jsp"/>
    <forward name="failure"    path="/enterLogon.do"/>
  </action>

I don't have any problems when I use a normal link (with the href property), but I can't get forward to work.

Any suggestions

Nikolaus Rumm


Re: forwarding with

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
The value you specify for the "forward" attribute should be the logical
name of a global ActionForward definition, like "success" or "failure".
Note that these <forward> definitions must be global (not nested inside
an <action> element) to be recognized by the tag.

If you want to create a normal hyperlink, use the "href" property
instead of "forward.  In other words, you would say:

    <struts:link href="/createUser.do">link</struts:link>

for a hyperlink to the create user action.

Craig McClanahan


Nikolaus Rumm wrote:

> Hello, I can't forward to another action. I tried... <struts:link
> forward="createUser">link</struts:link><struts:link
> forward="createUser.do">link</struts:link><struts:link
> forward="/createUser">link</struts:link><struts:link
> forward="/createUser.do">link</struts:link> ...but the resulting
> exception always looks like this: javax.servlet.ServletException:
> Cannot locate global forwarding for {0}
> java.lang.Throwable(java.lang.String)
> java.lang.Exception(java.lang.String)
> javax.servlet.ServletException(java.lang.Throwable)
> void
> org.apache.jasper.runtime.PageContextImpl.handlePageException(java.lang.Exception)
>
> void
> _0002flogon_0002ejsplogon_jsp_25._jspService(javax.servlet.http.HttpServletRequest,
> javax.servlet.http.HttpServletResponse)
> ...... The relevant section from action.xml looks like this:   <!--
> create user -->
>   <action    path="/createUser"
>       actionClass="com.dolores.client.participant.CreateUserAction"
>     formAttribute="userForm"
>         formClass="com.dolores.client.participant.UserForm"
>         inputForm="/user.jsp">
>     <forward name="success"    path="/user.jsp"/>
>     <forward name="failure"    path="/enterLogon.do"/>
>   </action>I don't have any problems when I use a normal link (with
> the href property), but I can't get forward to work. Any
> suggestions Nikolaus Rumm