You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joe Germuska <Jo...@Germuska.com> on 2004/10/15 17:21:55 UTC

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

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 : 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