You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "McCormack, Chris" <Ch...@littlewoods.co.uk> on 2004/10/15 11:42:04 UTC

RE: help : chaining actions in Struts

Have the first action's success forward on to the next action in struts config.

Chris McCormack

-----Original Message-----
From: sachin [mailto:sachin.hegde@paradyne.co.in]
Sent: 15 October 2004 10:46
To: Struts Users Mailing List
Subject: help : chaining actions in Struts


hi all ,

i have a common bean , which i need to use for two Actions classes which will 
execute one after another and populate the bean.

Now how can i configure the struts so that both the action will run one after 
another ? 

Any help is welcome . . 

Regards,
Sachin Hegde

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


***********************************************
This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has come to you in error, please 
notify the sender immediately and delete this 
e-mail from your system.
You must take no action based on this, nor must 
you copy or disclose it or any part of its contents 
to any person or organisation.
Statements and opinions contained in this email may 
not necessarily represent those of Littlewoods.
Please note that e-mail communications may be monitored.
The registered office of Littlewoods Limited and its
subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
Registered number of Littlewoods Limited is 262152.
************************************************


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


Re: Help : creating dynamic styleId inside Logic:iterate

Posted by Derek Broughton <de...@pointerstop.ca>.
On Monday 29 November 2004 14:27, Aidas Semezys wrote:
> It is not allowed to have just part of attribute value as JSP expression.
> Here is the correct solution:
> <html:text name="iType" styleId="<%="sp" + iterator%>"
> property="sharesPer"/>

Thanks!  That solved a problem I was about to ask ...
-- 
derek

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


Re: Help : creating dynamic styleId inside Logic:iterate

Posted by Aidas Semezys <ai...@gmail.com>.
It is not allowed to have just part of attribute value as JSP expression.
Here is the correct solution:
<html:text name="iType" styleId="<%="sp" + iterator%>" property="sharesPer"/>

Peace,
Aidas

sachin <sa...@paradyne.co.in> wrote:
> I have a jsp page in which i have a loop and a text field inside it.
> Now to create a dynamic styleid i have used the following code..
> 
> but when this code executes , it does not print the actual value of itrator .
> It should give  styleId="sp0" , styleId="sp1" , styleId="sp2" likewise ..
> but it prints simply  ' styleId="sp<% = itrator %>" '  for all the fields .
> 
> can someone provide a solution to create dynamic styleId ... ?
> 
> <% int itrator=0; %>
> <logic:iterate id="iType" property="investorTypeList" name="sharePatternBean">
> <html:text name="iType" styleId="sp<% = itrator %>" property="sharesPer"
> readonly="true" />
> <%itrator++;%>
> </logic:iterate>
> 
> Regards,
> Sachin Hegde,
> Software Developer,
> Paradyne Infotech Limited,
> Mumbai
> 022-38546711
> 
> ---------------------------------------------------------------------
> 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


Help : creating dynamic styleId inside Logic:iterate

Posted by sachin <sa...@paradyne.co.in>.
I have a jsp page in which i have a loop and a text field inside it.
Now to create a dynamic styleid i have used the following code..

but when this code executes , it does not print the actual value of itrator .
It should give  styleId="sp0" , styleId="sp1" , styleId="sp2" likewise ..
but it prints simply  ' styleId="sp<% = itrator %>" '  for all the fields .

can someone provide a solution to create dynamic styleId ... ?

<% int itrator=0; %>
<logic:iterate id="iType" property="investorTypeList" name="sharePatternBean">
<html:text name="iType" styleId="sp<% = itrator %>" property="sharesPer" 
readonly="true" />
<%itrator++;%>
</logic:iterate>

Regards,
Sachin Hegde,
Software Developer,
Paradyne Infotech Limited,
Mumbai
022-38546711

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


RE: help : Thanks Joe - chaining actions in Struts -

Posted by Joe Germuska <Jo...@Germuska.com>.
At 7:24 PM +0530 10/15/04, sachin wrote:
>Thanks Joe
>
>I have quit the idea of chaining actions.
>It is true that Struts was never designed to for action forwarding.
>My main concern was to have some common functionality independantly
>which i can do better by creating own replica of Action , ActionForm and
>ActionServlet etc . . and chaining can be avoided altogether ..

Note that where you might extend ActionServlet, you might also be 
able to use Struts PlugIns or J2EE ServletContextListeners to 
initialize supporting classes at application startup time instead. 
The reason to choose PlugIns is if you want your PlugIn to be aware 
of the Struts Module in which it was configured, or if you are still 
using Servlet 2.2, which didn't have ServletContextListener (or, if 
you're like me and you've been using PlugIns for a long time and are 
too lazy to switch.)

Typically, a PlugIn (or SCL) gets instantiated and triggered during 
the setup process of the ServletContext.  The way I typically use it 
is to instantiate and configure some business expert class and put 
that class in the ServletContext under a well known key.  Then, my 
Actions can reliably get that class out of the ServletContext and use 
it as a facade over business processes about which they shouldn't 
know any more than necessary.    (I'll often have a base Action class 
which provides a typesafe "getXXXExpert" method which knows the 
ServletContext key and makes that all a little cleaner.  More 
recently, we've inverted that model to make a base action which 
builds an ActionContext bean which encapsulates the request, 
response, form, and mapping, and which then has property accessors 
for these kinds of experts as well.  It's a little more setup ahead 
of time, but I'm finding it a nice way to do things.  On the dev 
list, we've talked a bit about making this something that is built in 
to Struts, but it hasn't gotten much past talk.

I suppose strictly speaking, this isn't all that different from your 
actions getting a custom subclass of ActionServlet and using it as 
the expert, but I'm more comfortable with a sharper separation of 
concerns.

Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
back; I'll know I'm in the wrong place."
    - Carlos Santana

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


RE: help : Thanks Joe - chaining actions in Struts -

Posted by sachin <sa...@paradyne.co.in>.
Thanks Joe

I have quit the idea of chaining actions.
It is true that Struts was never designed to for action forwarding.
My main concern was to have some common functionality independantly
which i can do better by creating own replica of Action , ActionForm and 
ActionServlet etc . . and chaining can be avoided altogether .. 

Regards,
Sachin Hegde
Software Developer
Paradyne Infotech Limited
Mumbai
022-38546711


---------- Original Message -----------
From: Joe Germuska <Jo...@Germuska.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Fri, 15 Oct 2004 08:08:54 -0500
Subject: RE: help : chaining actions in Struts

> I guess I'll post the obligatory "that isn't considered a good idea" 
> message.  Clearly, you've gotten feedback from people who do it, so 
> I can't just tell you that it doesn't work.  However, I can tell you 
> that Struts was never designed to for action forwarding, and by 
> forwarding from one action to another, you trigger a second complete 
> pass through the entire RequestProcessor cycle, which can sometimes 
> have unexpected effects on the request context.
> 
> So, while action chaining sometimes works for some people in some 
> cases, Struts wasn't designed to do it, and bugs relating to it are 
> considered "invalid".
> 
> There are usually other ways to achieve the same goal, especially if 
> you are being conscientious about putting your business logic in a 
> layer that is relatively independent of Struts and keeping Struts 
> focused on translating HTTP requests into business requests and 
> making calls against your business layer.
> 
> Note also that the Struts RequestProcessor is evolving into a more 
> flexibly composable "chain" model of request processing.  Once that 
> code is merged into the main branch of development, you may find 
> that it provides a way that you could line up multiple action 
> executions without triggering all of the pre-processing that comes 
> before the action execution.  This isn't something anyone has 
> tackled yet, but the basic changes to the design make it something 
> much more readily achievable.
> 
> The Chain-based request processor is currently in Struts contrib,
>  and is thoroughly usable already, and Don Brown has said he may 
> find time this weekend (or soon) to change the development Struts 
> code to use it as the standard processing mechanism.
> 
> Joe
> 
> At 3:40 PM +0530 10/15/04, sachin wrote:
> >  > Have the first action's success forward on to the next action in
> >>  struts config.
> >
> >but will the same bean be populated ?
> >
> >Regards ,
> >sachin
> >
> >
> >---------- Original Message -----------
> >From: "McCormack, Chris" <Ch...@littlewoods.co.uk>
> >To: "Struts Users Mailing List" <us...@struts.apache.org>
> >Sent: Fri, 15 Oct 2004 10:42:04 +0100
> >Subject: RE: help : chaining actions in Struts
> >
> >>  Have the first action's success forward on to the next action in
> >>  struts config.
> >>
> >>  Chris McCormack
> >>
> >>  -----Original Message-----
> >>  From: sachin [mailto:sachin.hegde@paradyne.co.in]
> >>  Sent: 15 October 2004 10:46
> >>  To: Struts Users Mailing List
> >>  Subject: help : chaining actions in Struts
> >>
> >>  hi all ,
> >>
> >>  i have a common bean , which i need to use for two Actions classes
> >>  which will execute one after another and populate the bean.
> >>
> >>  Now how can i configure the struts so that both the action will run
> >>  one after another ?
> >>
> >>  Any help is welcome . .
> >>
> >>  Regards,
> >>  Sachin Hegde
> >>
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>  For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>  ***********************************************
> >>  This e-mail and its attachments are confidential
> >>  and are intended for the above named recipient
> >>  only. If this has come to you in error, please
> >>  notify the sender immediately and delete this
> >>  e-mail from your system.
> >>  You must take no action based on this, nor must
> >>  you copy or disclose it or any part of its contents
> >>  to any person or organisation.
> >>  Statements and opinions contained in this email may
> >>  not necessarily represent those of Littlewoods.
> >>  Please note that e-mail communications may be monitored.
> >>  The registered office of Littlewoods Limited and its
> >>  subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
> >>  Registered number of Littlewoods Limited is 262152.
> >>  ************************************************
> >>
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>  For additional commands, e-mail: user-help@struts.apache.org
> >------- End of Original Message -------
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> 
> --
> Joe Germuska            
> Joe@Germuska.com  
> http://blog.germuska.com    
> "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
> back; I'll know I'm in the wrong place."
>     - Carlos Santana
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
------- End of Original Message -------


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


RE: help : chaining actions in Struts

Posted by Joe Germuska <Jo...@Germuska.com>.
I guess I'll post the obligatory "that isn't considered a good idea" 
message.  Clearly, you've gotten feedback from people who do it, so I 
can't just tell you that it doesn't work.  However, I can tell you 
that Struts was never designed to for action forwarding, and by 
forwarding from one action to another, you trigger a second complete 
pass through the entire RequestProcessor cycle, which can sometimes 
have unexpected effects on the request context.

So, while action chaining sometimes works for some people in some 
cases, Struts wasn't designed to do it, and bugs relating to it are 
considered "invalid".

There are usually other ways to achieve the same goal, especially if 
you are being conscientious about putting your business logic in a 
layer that is relatively independent of Struts and keeping Struts 
focused on translating HTTP requests into business requests and 
making calls against your business layer.

Note also that the Struts RequestProcessor is evolving into a more 
flexibly composable "chain" model of request processing.  Once that 
code is merged into the main branch of development, you may find that 
it provides a way that you could line up multiple action executions 
without triggering all of the pre-processing that comes before the 
action execution.  This isn't something anyone has tackled yet, but 
the basic changes to the design make it something much more readily 
achievable.

The Chain-based request processor is currently in Struts contrib, and 
is thoroughly usable already, and Don Brown has said he may find time 
this weekend (or soon) to change the development Struts code to use 
it as the standard processing mechanism.

Joe



At 3:40 PM +0530 10/15/04, sachin wrote:
>  > Have the first action's success forward on to the next action in
>>  struts config.
>
>but will the same bean be populated ?
>
>Regards ,
>sachin
>
>
>---------- Original Message -----------
>From: "McCormack, Chris" <Ch...@littlewoods.co.uk>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Sent: Fri, 15 Oct 2004 10:42:04 +0100
>Subject: RE: help : chaining actions in Struts
>
>>  Have the first action's success forward on to the next action in
>>  struts config.
>>
>>  Chris McCormack
>>
>>  -----Original Message-----
>>  From: sachin [mailto:sachin.hegde@paradyne.co.in]
>>  Sent: 15 October 2004 10:46
>>  To: Struts Users Mailing List
>>  Subject: help : chaining actions in Struts
>>
>>  hi all ,
>>
>>  i have a common bean , which i need to use for two Actions classes
>>  which will execute one after another and populate the bean.
>>
>>  Now how can i configure the struts so that both the action will run
>>  one after another ?
>>
>>  Any help is welcome . .
>>
>>  Regards,
>>  Sachin Hegde
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>  For additional commands, e-mail: user-help@struts.apache.org
>>
>>  ***********************************************
>>  This e-mail and its attachments are confidential
>>  and are intended for the above named recipient
>>  only. If this has come to you in error, please
>>  notify the sender immediately and delete this
>>  e-mail from your system.
>>  You must take no action based on this, nor must
>>  you copy or disclose it or any part of its contents
>>  to any person or organisation.
>>  Statements and opinions contained in this email may
>>  not necessarily represent those of Littlewoods.
>>  Please note that e-mail communications may be monitored.
>>  The registered office of Littlewoods Limited and its
>>  subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
>>  Registered number of Littlewoods Limited is 262152.
>>  ************************************************
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>  For additional commands, e-mail: user-help@struts.apache.org
>------- End of Original Message -------
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


--
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
back; I'll know I'm in the wrong place."
    - Carlos Santana

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


RE: help : chaining actions in Struts

Posted by sachin <sa...@paradyne.co.in>.
> Have the first action's success forward on to the next action in 
> struts config.

but will the same bean be populated ?

Regards , 
sachin


---------- Original Message -----------
From: "McCormack, Chris" <Ch...@littlewoods.co.uk>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Fri, 15 Oct 2004 10:42:04 +0100
Subject: RE: help : chaining actions in Struts

> Have the first action's success forward on to the next action in 
> struts config.
> 
> Chris McCormack
> 
> -----Original Message-----
> From: sachin [mailto:sachin.hegde@paradyne.co.in]
> Sent: 15 October 2004 10:46
> To: Struts Users Mailing List
> Subject: help : chaining actions in Struts
> 
> hi all ,
> 
> i have a common bean , which i need to use for two Actions classes 
> which will execute one after another and populate the bean.
> 
> Now how can i configure the struts so that both the action will run 
> one after another ?
> 
> Any help is welcome . .
> 
> Regards,
> Sachin Hegde
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ***********************************************
> This e-mail and its attachments are confidential
> and are intended for the above named recipient
> only. If this has come to you in error, please 
> notify the sender immediately and delete this 
> e-mail from your system.
> You must take no action based on this, nor must 
> you copy or disclose it or any part of its contents 
> to any person or organisation.
> Statements and opinions contained in this email may 
> not necessarily represent those of Littlewoods.
> Please note that e-mail communications may be monitored.
> The registered office of Littlewoods Limited and its
> subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
> Registered number of Littlewoods Limited is 262152.
> ************************************************
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
------- End of Original Message -------


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