You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Woon <mo...@SMI.Stanford.EDU> on 2002/01/05 03:54:47 UTC
Questions on Actions
Hello all...
I've got a couple more questions I'm hoping someone can help me with:
1) What's the difference between <action include> and <action forward>
if they both target a JSP page? Is it the same as <jsp:include> vs.
<jsp:forward> (I don't see how it could be)?
2) After an <action include> or <action forward>, how do I specify what
the next <action> to take should be? Must it be static, or can the
action by dynamic, like a call to <action type>?
Thanks,
-Mark
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Questions on Actions
Posted by Robert Parker <ro...@racv.com.au>.
----- Original Message -----
From: "Mark Woon" <mo...@SMI.Stanford.EDU>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, January 08, 2002 1:19 PM
Subject: Re: Questions on Actions
[snip]
>
> You're basically saying I don't need to use Struts. And you're right, I
already
> have everything working in JSP's.
>
Definitely not! I'm definitely advocating struts. In particular I avocate
the model where jsp's are responsible for nothing more than displaying
pages/responses. The struts actions are responsible for handling the request
and packaging the data, ready for the jsp to assemble and display the data.
Hence the struts action knows nothing about how the result is displayed and
the jsp knows nothing of the business logic used to handle the request.
Hence the sequence of calls would be...
Browser --> Action Servlet --> Action object --> jsp --> result to browser
> However, I'd like to see how Struts would handle something like this. So
let me
> change the scenario a little bit more:
>
> print a.jsp or b.jsp
> print c.jsp or d.jsp
>
> How would I do something like this? Can the ActionServlet controller
regain
> control after handing it over to either a.jsp or b.jsp so that it can
decide if
> c.jsp or d.jsp should be printed? If so, how?
>
Not quite following what you want to do here - but assuming you want to use
a,b,c or d.jsp to display a result, I'm assuming that there is some data
item which determines what jsp to use as the view. Thus you may end up with
some sort of case statement in your action object. Hence your action object
performs the request and packages the data into a bean(s), then use the
case/switch type statement to forward to the particular page you want to
display the result. Also note that you can have a different action class for
each type of request - thus you don't need an actiona class with one huge
switch statement.
regards
Rob
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Questions on Actions
Posted by Mark Woon <mo...@SMI.Stanford.EDU>.
Robert Parker wrote:
> If you look at the template taglib, you can setup a template jsp which
> always includes the header, footer, and a body section. Hence you don't need
> to worry about the header and footer, just the main content in the body
> section. Thus your action doesn't need to be concernered with header or
> footer. Once again - have a look at the template taglib examples
You're basically saying I don't need to use Struts. And you're right, I already
have everything working in JSP's.
However, I'd like to see how Struts would handle something like this. So let me
change the scenario a little bit more:
print a.jsp or b.jsp
print c.jsp or d.jsp
How would I do something like this? Can the ActionServlet controller regain
control after handing it over to either a.jsp or b.jsp so that it can decide if
c.jsp or d.jsp should be printed? If so, how?
-Mark
> ----- Original Message -----
> From: "Mark Woon" <mo...@SMI.Stanford.EDU>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Tuesday, January 08, 2002 12:34 PM
> Subject: Re: Questions on Actions
>
> >
> > I must be missing something. I want to do something like this:
> >
> > print header.jsp
> > print a.jsp or b.jsp
> > print footer.jsp
> >
> > If an Action can only forward to another action, it can't both print
> header.jsp
> > and decide whether to pass control over to a.jsp or b.sjp, can it?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Questions on Actions
Posted by Robert Parker <ro...@racv.com.au>.
If you look at the template taglib, you can setup a template jsp which
always includes the header, footer, and a body section. Hence you don't need
to worry about the header and footer, just the main content in the body
section. Thus your action doesn't need to be concernered with header or
footer. Once again - have a look at the template taglib examples
regards
Rob
----- Original Message -----
From: "Mark Woon" <mo...@SMI.Stanford.EDU>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, January 08, 2002 12:34 PM
Subject: Re: Questions on Actions
>
> I must be missing something. I want to do something like this:
>
> print header.jsp
> print a.jsp or b.jsp
> print footer.jsp
>
> If an Action can only forward to another action, it can't both print
header.jsp
> and decide whether to pass control over to a.jsp or b.sjp, can it?
>
>
> Ted Husted wrote:
>
> > There are standard Actions for including and forwarding, but they are
> > not used much in practice.
> >
> > The can be useful for interacting with other systems, but not so much as
> > part of a typical Struts application.
> >
> > Typically, you write your own Actions, and return an ActionForward at
> > the end to indicate where that control should pass to another Action or
> > a presentation page.
> >
> > ActionForwards can be local to the Action, global to the config file, or
> > created dynamically in the Action.
> >
> > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > -- Building Java web applications with Struts.
> > -- Tel +1 585 737-3463.
> > -- Web http://www.husted.com/struts/
> >
> > Mark Woon wrote:
> > >
> > > Hello all...
> > >
> > > I've got a couple more questions I'm hoping someone can help me with:
> > >
> > > 1) What's the difference between <action include> and <action
forward>
> > > if they both target a JSP page? Is it the same as <jsp:include> vs.
> > > <jsp:forward> (I don't see how it could be)?
> > >
> > > 2) After an <action include> or <action forward>, how do I specify
what
> > > the next <action> to take should be? Must it be static, or can the
> > > action by dynamic, like a call to <action type>?
> > >
> > > Thanks,
> > > -Mark
> > >
> > > --
> > > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
> --
> ~~Mark Woon~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> If you're not part of the solution, you're part of the precipitate.
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Questions on Actions
Posted by Mark Woon <mo...@SMI.Stanford.EDU>.
I must be missing something. I want to do something like this:
print header.jsp
print a.jsp or b.jsp
print footer.jsp
If an Action can only forward to another action, it can't both print header.jsp
and decide whether to pass control over to a.jsp or b.sjp, can it?
Ted Husted wrote:
> There are standard Actions for including and forwarding, but they are
> not used much in practice.
>
> The can be useful for interacting with other systems, but not so much as
> part of a typical Struts application.
>
> Typically, you write your own Actions, and return an ActionForward at
> the end to indicate where that control should pass to another Action or
> a presentation page.
>
> ActionForwards can be local to the Action, global to the config file, or
> created dynamically in the Action.
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Building Java web applications with Struts.
> -- Tel +1 585 737-3463.
> -- Web http://www.husted.com/struts/
>
> Mark Woon wrote:
> >
> > Hello all...
> >
> > I've got a couple more questions I'm hoping someone can help me with:
> >
> > 1) What's the difference between <action include> and <action forward>
> > if they both target a JSP page? Is it the same as <jsp:include> vs.
> > <jsp:forward> (I don't see how it could be)?
> >
> > 2) After an <action include> or <action forward>, how do I specify what
> > the next <action> to take should be? Must it be static, or can the
> > action by dynamic, like a call to <action type>?
> >
> > Thanks,
> > -Mark
> >
> > --
> > To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
~~Mark Woon~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you're not part of the solution, you're part of the precipitate.
Re: Questions on Actions
Posted by Ted Husted <hu...@apache.org>.
There are standard Actions for including and forwarding, but they are
not used much in practice.
The can be useful for interacting with other systems, but not so much as
part of a typical Struts application.
Typically, you write your own Actions, and return an ActionForward at
the end to indicate where that control should pass to another Action or
a presentation page.
ActionForwards can be local to the Action, global to the config file, or
created dynamically in the Action.
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/
Mark Woon wrote:
>
> Hello all...
>
> I've got a couple more questions I'm hoping someone can help me with:
>
> 1) What's the difference between <action include> and <action forward>
> if they both target a JSP page? Is it the same as <jsp:include> vs.
> <jsp:forward> (I don't see how it could be)?
>
> 2) After an <action include> or <action forward>, how do I specify what
> the next <action> to take should be? Must it be static, or can the
> action by dynamic, like a call to <action type>?
>
> Thanks,
> -Mark
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>