You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/06/18 19:55:02 UTC

Same Action, different Views

Subject: Same Action, different Views
From: "C. Allen Sher" <sh...@bls.gov>
 ===
What is the preferred way to implement "Same Model+Action, Different Views"
in struts?
I want to build an Action that answers to HTTP requests both from a browser
and from a GUI.
The Action and the Bean are the same, the view for the GUI does not need
much of the HTML dress-up.

I thought about have two Actions in struts-config.xml that uses the same
Action class.
Do we have anything more elegant than that?




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Same Action, different Views

Posted by Robert Williams <rj...@attbi.com>.
Generating anything in the response from within an Action is a violation of
MVC concepts.  I don't think you want to do that.  Better to send a
parameter with the input that controls which forward to use from your Action
to generate the response.  One "jsp" should generate the HTML response and
another should generate what ever the GUI needs.  You won't be able to use
Struts tags in the GUI response, but that shouldn't be a problem, as you
will have to format the response in some non-HTML format.  Hmmm maybe XML???

bob

----- Original Message -----
From: "Joseph Barefoot" <jo...@hereuare.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, June 19, 2002 1:05 PM
Subject: RE: Same Action, different Views


> hmmm...wouldn't you need to do something wildly different in your Action,
> i.e. write specific data to the HTTPServletResponse, when using the GUI
> client?  Unless you have it set up to follow HTTP forwards and parse the
> responses or something as a browser would....
>
>
>
> > -----Original Message-----
> > From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
> > Sent: Tuesday, June 18, 2002 10:55 AM
> > To: struts-user@jakarta.apache.org
> > Subject: Same Action, different Views
> >
> >
> > Subject: Same Action, different Views
> > From: "C. Allen Sher" <sh...@bls.gov>
> >  ===
> > What is the preferred way to implement "Same Model+Action,
> > Different Views"
> > in struts?
> > I want to build an Action that answers to HTTP requests both from
> > a browser
> > and from a GUI.
> > The Action and the Bean are the same, the view for the GUI does not need
> > much of the HTML dress-up.
> >
> > I thought about have two Actions in struts-config.xml that uses the same
> > Action class.
> > Do we have anything more elegant than that?
> >
> >
> >
> >
> > --
> > 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>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Same Action, different Views

Posted by Robert Taylor <ro...@yahoo.com>.
You might want to take a look at Ted Husted's Artimus
package. I believe he uses business beans which can be
used in Actions or GUI environment. A business bean is
invoked for an action mapping to perform any business
logic (Command pattern) and the Action class becomes a
simple proxie to the business bean.  

robert
--- Joseph Barefoot <jo...@hereuare.com> wrote:
> hmmm...wouldn't you need to do something wildly
> different in your Action,
> i.e. write specific data to the HTTPServletResponse,
> when using the GUI
> client?  Unless you have it set up to follow HTTP
> forwards and parse the
> responses or something as a browser would....
> 
> 
> 
> > -----Original Message-----
> > From: Struts Newsgroup
> [mailto:@Basebeans.comstruts@basebeans.com]
> > Sent: Tuesday, June 18, 2002 10:55 AM
> > To: struts-user@jakarta.apache.org
> > Subject: Same Action, different Views
> >
> >
> > Subject: Same Action, different Views
> > From: "C. Allen Sher" <sh...@bls.gov>
> >  ===
> > What is the preferred way to implement "Same
> Model+Action,
> > Different Views"
> > in struts?
> > I want to build an Action that answers to HTTP
> requests both from
> > a browser
> > and from a GUI.
> > The Action and the Bean are the same, the view for
> the GUI does not need
> > much of the HTML dress-up.
> >
> > I thought about have two Actions in
> struts-config.xml that uses the same
> > Action class.
> > Do we have anything more elegant than that?
> >
> >
> >
> >
> > --
> > 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>
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Same Action, different Views

Posted by Joseph Barefoot <jo...@hereuare.com>.
hmmm...wouldn't you need to do something wildly different in your Action,
i.e. write specific data to the HTTPServletResponse, when using the GUI
client?  Unless you have it set up to follow HTTP forwards and parse the
responses or something as a browser would....



> -----Original Message-----
> From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
> Sent: Tuesday, June 18, 2002 10:55 AM
> To: struts-user@jakarta.apache.org
> Subject: Same Action, different Views
>
>
> Subject: Same Action, different Views
> From: "C. Allen Sher" <sh...@bls.gov>
>  ===
> What is the preferred way to implement "Same Model+Action,
> Different Views"
> in struts?
> I want to build an Action that answers to HTTP requests both from
> a browser
> and from a GUI.
> The Action and the Bean are the same, the view for the GUI does not need
> much of the HTML dress-up.
>
> I thought about have two Actions in struts-config.xml that uses the same
> Action class.
> Do we have anything more elegant than that?
>
>
>
>
> --
> 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>