You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Collings <jl...@gmail.com> on 2009/05/15 13:16:19 UTC

Problem dispatching in /content dir

So I have a jsp that needs to submit to another jsp. Both are in /content.
When I use file-name.jsp I get 404. When I use file-name, I get the action
that file-name.jsp submits to.

Any ideas on how I can work around this?

Jim C.

RE: Problem dispatching in /content dir

Posted by Steve <st...@sjlt.co.uk>.
Jim,

The normal process is to call the action e.g. <a href="goMyPage.action">

Struts will then (eventually) call the actions execute () method. This
returns a string that is mapped to the correct jsp page using a file like
my-struts.xml. The mapping will look something like: -

    <action name="goMyPage" class="...MyPage">
    	<result>/content/EverythingOK.jsp</result>
    	<result name="error">/content/ErrorPage.jsp</result>
    </action>

If you don't follow this paradigm then the framework will not be able to
perform the actions processing work or make any data available to the JSP
page. In other words you won't be using the framework.

Of course you can link directly to an html page. However I don't see the
reason to link to a jsp page unless it can pull some dynamic content out
from the framework.

Does this help?

Kind Regards,

Steve

-----Original Message-----
From: Jim Collings [mailto:jlistnews@gmail.com] 
Sent: 15 May 2009 12:16
To: Struts Users Mailing List
Subject: Problem dispatching in /content dir

So I have a jsp that needs to submit to another jsp. Both are in /content.
When I use file-name.jsp I get 404. When I use file-name, I get the action
that file-name.jsp submits to.

Any ideas on how I can work around this?

Jim C.


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


Re: Problem dispatching in /content dir

Posted by Jim Kiley <jh...@summa-tech.com>.
If you're using annotation-based results, and you extend ActionSupport, the
dummy action class is just a few lines -- it has no class body at all.
jk

On Fri, May 15, 2009 at 9:53 AM, Jim Collings <jl...@gmail.com> wrote:

> I take it back. I only thought I had it figured out. I'll use the
> dummy action. I find it distasteful but it seems the best way.
>
>
> Jim C.
>
> On Fri, May 15, 2009 at 9:07 AM, Jim Kiley <jh...@summa-tech.com> wrote:
> > What I've done in this situation is put in the dummy action.  Inevitably
> I
> > find myself needing some kind of pre-processing before the JSP is loaded
> up
> > -- even when I don't initially believe that I will -- and the dummy
> action
> > is the right place for it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Re: Problem dispatching in /content dir

Posted by Jim Collings <jl...@gmail.com>.
I take it back. I only thought I had it figured out. I'll use the
dummy action. I find it distasteful but it seems the best way.


Jim C.

On Fri, May 15, 2009 at 9:07 AM, Jim Kiley <jh...@summa-tech.com> wrote:
> What I've done in this situation is put in the dummy action.  Inevitably I
> find myself needing some kind of pre-processing before the JSP is loaded up
> -- even when I don't initially believe that I will -- and the dummy action
> is the right place for it.

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


Re: Problem dispatching in /content dir

Posted by Jim Kiley <jh...@summa-tech.com>.
What I've done in this situation is put in the dummy action.  Inevitably I
find myself needing some kind of pre-processing before the JSP is loaded up
-- even when I don't initially believe that I will -- and the dummy action
is the right place for it.
jk

On Fri, May 15, 2009 at 7:40 AM, Jim Collings <jl...@gmail.com> wrote:

> Here's a bit of clarification:
>
> page-one.jsp which is in /content
>     |
>     \-page-two      <--Have to use this to access page two because
> it, also is in "/content". This means calling an empty "execute()".
>          |
>          \-page-two.jsp
>               |
>               \page-two  <--Page two action "page-two!dosomething"
>
> Now I could put in a dummy action that just forwards to "page-two.jsp"
> but why? It seems like there should be a better way.
>
>
> Jim C.
>
> On Fri, May 15, 2009 at 7:16 AM, Jim Collings <jl...@gmail.com> wrote:
> >
> > So I have a jsp that needs to submit to another jsp. Both are in
> /content. When I use file-name.jsp I get 404. When I use file-name, I get
> the action that file-name.jsp submits to.
> >
> > Any ideas on how I can work around this?
> >
> > Jim C.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

RE: Problem dispatching in /content dir

Posted by Steve <st...@sjlt.co.uk>.
There is. Create a simple action in your struts xml file and map it to the
framework class ActionSupport (com.opensymphony.xwork2.ActionSupport).

I haven't done this myself (although I have derived my actions from
ActionSupport). But I believe it will do what you want.

Cheers,

Steve

-----Original Message-----
From: Jim Collings [mailto:jlistnews@gmail.com] 
Sent: 15 May 2009 12:41
To: Struts Users Mailing List
Subject: Re: Problem dispatching in /content dir

Here's a bit of clarification:

page-one.jsp which is in /content
     |
     \-page-two      <--Have to use this to access page two because
it, also is in "/content". This means calling an empty "execute()".
          |
          \-page-two.jsp
               |
               \page-two  <--Page two action "page-two!dosomething"

Now I could put in a dummy action that just forwards to "page-two.jsp"
but why? It seems like there should be a better way.


Jim C.

On Fri, May 15, 2009 at 7:16 AM, Jim Collings <jl...@gmail.com> wrote:
>
> So I have a jsp that needs to submit to another jsp. Both are in /content.
When I use file-name.jsp I get 404. When I use file-name, I get the action
that file-name.jsp submits to.
>
> Any ideas on how I can work around this?
>
> Jim C.

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


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


Re: Problem dispatching in /content dir

Posted by Jim Collings <jl...@gmail.com>.
Here's a bit of clarification:

page-one.jsp which is in /content
     |
     \-page-two      <--Have to use this to access page two because
it, also is in "/content". This means calling an empty "execute()".
          |
          \-page-two.jsp
               |
               \page-two  <--Page two action "page-two!dosomething"

Now I could put in a dummy action that just forwards to "page-two.jsp"
but why? It seems like there should be a better way.


Jim C.

On Fri, May 15, 2009 at 7:16 AM, Jim Collings <jl...@gmail.com> wrote:
>
> So I have a jsp that needs to submit to another jsp. Both are in /content. When I use file-name.jsp I get 404. When I use file-name, I get the action that file-name.jsp submits to.
>
> Any ideas on how I can work around this?
>
> Jim C.

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