You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ajay Patil <ap...@vertex.co.in> on 2003/07/30 04:11:21 UTC

RE: Multiple modules - Please help

Dear Steve,

Thanks for finding the problem in the configuration file. I had 
not realized it. ** sorry for the typo in bug report **

So, now I have an enhancement request.. :)

Would it be possible to enhance ForwardAction so that it also 
requires a MODULE relative path ?

It would be then very intuitive and convenient.
Also, splitting into modules will be easier as you simply have to
chop off the module path globally. Changing module names will be
even easier.

If you think the above is ok and it doesnt conflict with the current 
implementation, I shall re-open the bug as an enhancement request.

Please let me know,

Thanks a bunch,
Ajay

Ajay,
I've closed this bug. It seems to be a configuration problem...

I'm assuming that your add.jsp and edit.jsp files are in the /admin
directory.

The problem is with your configuration. ForwardAction requires a CONTEXT
relative path which, in this case would be:

 <action path="/showEdit"
         type="org.apache.struts.actions.ForwardAction"
         parameter="/admin/edit.jsp">
 </action>

(Note also, you had your parameter in a separate tag, but it should be 
an
attribute of the action tag. Not sure if that's what you actually had in
your
source or it's just a typo in the bug report, but it wouldn't help!)

The reason it worked when you used your own custom action is that by 
default
ActionFoward paths are MODULE relative, so your configuration entry
"/edit.jsp"
would be translated by the RequestProcessor to a context relative path 
of
"/admin/edit.jsp"

... if you still have problems after this, please post back to the user
list.

Steve




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Multiple modules - Please help

Posted by Steve Raeburn <sr...@apache.org>.
It wouldn't be (easily) possible to change ForwardAction to be configurable
between context and module relative because the ActionMapping only has one
parameter which is already being used to provide the path.

A couple of options would be to create a second version of ForwardAction
(ModuleForwardAction ?) that returns a module relative ActionForward, or to
create a simple action that returns an ActionForward which is configured in
struts-config with a well-known name ("success", in my example).

I prefer the latter approach because it is more flexible and uses the
standard method of configuring the ActionForward via struts-config. You'd
have to create your own for now, but I hope to add this as a standard
action.

The action (SuccessAction):
  public ActionForward execute(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
      throws Exception {

      return mapping.findForward("success");

  }

struts-config.xml:
  <!-- Module relative mapping -->
  <action path="/showEdit"
          type="com.ninsky.struts.actions.SuccessAction">
    <forward name="success" path="/edit.jsp"/>
  </action>

-or-

  <!-- Context relative mapping -->
  <action path="/showEdit"
          type="com.ninsky.struts.actions.SuccessAction">
    <forward name="success" path="/admin/edit.jsp" contextRelative="true"/>
  </action>



Steve


> -----Original Message-----
> From: Ajay Patil [mailto:apatil@vertex.co.in]
> Sent: July 29, 2003 7:11 PM
> To: struts-user@jakarta.apache.org; sraeburn@apache.org
> Subject: RE: Multiple modules - Please help
>
>
> Dear Steve,
>
> Thanks for finding the problem in the configuration file. I had
> not realized it. ** sorry for the typo in bug report **
>
> So, now I have an enhancement request.. :)
>
> Would it be possible to enhance ForwardAction so that it also
> requires a MODULE relative path ?
>
> It would be then very intuitive and convenient.
> Also, splitting into modules will be easier as you simply have to
> chop off the module path globally. Changing module names will be
> even easier.
>
> If you think the above is ok and it doesnt conflict with the current
> implementation, I shall re-open the bug as an enhancement request.
>
> Please let me know,
>
> Thanks a bunch,
> Ajay



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org