Remove the forward {0} from your mapping.

On Fri, 11 Feb 2005 15:14:12 -0800, Betty Koon <[EMAIL PROTECTED]> wrote:
> Hubert,
> 
> I got passed that but now I am seeing the following:
> The value of id is = {0}text ...
> Howcome the value is not replaced correctly?
> 
> -Betty
> 
> -----Original Message-----
> From: Hubert Rabago [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 11, 2005 2:36 PM
> To: Struts Users Mailing List
> Subject: Re: argument to struts config forward mapping
> 
> You can't (and shouldn't) modify the result of mapping.findForward()
> -- as you've seen, Struts won't allow you even if you tried.
> 
> Do this instead:
> 
> ActionForward forward = new ActionForward(mapping.findForward("success"));
> forward.setPath(forward.getPath() + URLEncoder.encode(simpleForm.getId(),
> "UTF-8")); return forward;
> 
> Hubert
> 
> On Fri, 11 Feb 2005 14:33:21 -0800, Betty Koon <[EMAIL PROTECTED]> wrote:
> > Hubert,
> >
> > Thanks for your help.  But I am running into this exception, anything
> > I am doing wrong?
> >
> >         ActionForward forward = mapping.findForward("success");
> >         forward.setPath(forward.getPath() +
> > URLEncoder.encode(simpleForm.getId(), "UTF-8"));
> >           return forward;
> >
> > java.lang.IllegalStateException: Configuration is frozen
> >         at
> > org.apache.struts.config.ForwardConfig.setPath(ForwardConfig.java:208)
> >         at
> > examples.simple.ProcessSimpleAction.execute(ProcessSimpleAction.java:106)
> >         at
> > org.apache.struts.action.RequestProcessor.processActionPerform(Request
> > Proces
> > sor.java:484)
> >         at
> >
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
> >         at
> > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
> >         at
> > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> >
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
> > tStubImpl.java:1006)
> >         at
> >
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> > :419)
> >         at
> >
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> > :315)
> >         at
> >
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
> > ebAppServletContext.java:6718)
> >         at
> >
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
> > t.java:321)
> >         at
> > weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
> >         at
> >
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
> > ntext.java:3764)
> >         at
> >
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
> > :2644)
> >         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
> >         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
> >
> > -Betty
> >
> > -----Original Message-----
> > From: Hubert Rabago [mailto:[EMAIL PROTECTED]
> > Sent: Friday, February 11, 2005 2:22 PM
> > To: Struts Users Mailing List
> > Subject: Re: argument to struts config forward mapping
> >
> > Yes.
> >
> > Attachment 13818 would encode parameter values using UTF-8.  Of course
> > if you use that, you can change it to whatever you need.  You'd use it
> > like
> > this:
> >
> >      ActionRedirect redirect =
> >          new ActionRedirect(mapping.findForward("doRedirect"));
> >      redirect.addParameter("param1","value1");
> >      redirect.addParameter("param2",2);
> >      redirect.addParameter("param3",3.0);
> >      return redirect;
> >
> > Hubert
> >
> > On Fri, 11 Feb 2005 14:15:59 -0800, Betty Koon <[EMAIL PROTECTED]>
> > wrote:
> > > I am assuming that I will need to do all the proper URL encode at
> > > this level?
> > >
> > > -Betty
> > >
> > > -----Original Message-----
> > > From: Hubert Rabago [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, February 11, 2005 2:07 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: argument to struts config forward mapping
> > >
> > > What you can do is:
> > > >   <action path="/processSimple"  ... >
> > > >    <forward name="success" path="/jsp/simple/SimpleResults.jsp?id="
> > > >     redirect="true" />
> > > >   </action>
> > >
> > > ...then in your action:
> > >
> > > ActionForward result = new
> > > ActionForward(mapping.findForward("success"));
> > > result.setPath(result.getPath() + myIdValue);
> > > return result;
> > >
> > > If you need to specify more than one param, or need to decide which
> > > params to include at runtime, download the attachment [
> > > http://issues.apache.org/bugzilla/attachment.cgi?id=13818 ] to bug
> > > 866 [ http://issues.apache.org/bugzilla/show_bug.cgi?id=866 ].
> > > (Then if you'd like Struts to support this functionality, vote for
> > > the bug while you're
> > > there.)
> > >
> > > Hubert
> > >
> > > On Fri, 11 Feb 2005 13:58:28 -0800, Betty Koon <[EMAIL PROTECTED]>
> > > wrote:
> > > > Does 1.2.4 support the following?
> > > >
> > > >   <action path="/processSimple"  ... >
> > > >    <forward name="success" path="/jsp/simple/SimpleResults.jsp?id={0}"
> > > >     redirect="true" />
> > > >   </action>
> > > >
> > > > How would pass the argument in Action?  Thanks.
> > > >
> > > > -Betty
> > > >
> > > >
> > >
> > > --------------------------------------------------------------------
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to