struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raquel Pau Fernández" <raquel...@gmail.com>
Subject Re: JSP tags calling action directives
Date Mon, 08 Dec 2008 10:48:05 GMT
Yes,

I want to call services, but if I put the service in the action, at code
level, the action must know(implicitly) what is the following content page.
In addition, if an action code has two URL and for each URL has to send
different JSP content, your code must change or yo have to produce redundant
code in other action. It produces that if the workflow changes, your code
changes. You could also produce a chain of actions, but in my expirience, it
produces a bad maintenance because, for instance, you loss the traceability
between the code and the URL. Struts tutorials also says that it could
produce an spagetti code.

Consequently, I think that separating the workflow (actions) and the view
(calling it in some way, the service) is better . (I have solved it in
Struts 1 using a controller (now presented as view preparer) of the tiles
framework).

However, Struts2/Xwork implements the Command pattern without coupling with
the HTTP interface. For this reason, I think that it is unnecessary two
layers because the same framework offers the HTTP presentation/interface
layer, and then the action is a service.

Following these arguments, I need to call an action code from a JSP page
without becoming it an URL. I've not found that the framework could provide
it because always calls an action that must be an URL..

MAIN USE CASES:

-Each action that produces a forward to the same JSP does not need to know
what data is necessary to load for creating the page.
-The action code can be used in any URL without changing the code to show
any JSP.

Thank you in advance.

PD: Excuse me for my poor English.

2008/12/7 Dave Newton <newton.dave@yahoo.com>

> --- On Sun, 12/7/08, Raquel Pau Fernández wrote:
> > I'm thinking about calling actions code (that perhaps they are not
> > an URL and then they don't appear in the struts.xml) from JSP
> > [...]
> > For instance, in more than one page I could need the list
> > of users in different formats (combobox, lists and so on)
> > and perhaps I don't need to list them alone as an url
> > 'userList.action'.
> > [...]
>
> I'm not entirely sure I understand where you're coming from.
>
> The use-cases you describe sound like services. Service instances can be
> properties of actions, thus exposed to the JSP. Arbitrary methods can be
> called on action properties already.
>
> I'm not saying it's a bad idea, I just don't understand it or, so far, see
> a need for it.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Raquel Pau

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message