I use layouts to get around this problem as well. I simply have the name or id 
(whichever you need) be driven from a jsp value. My fields end up looking like 
this:

<s:layout-definition>
<s:form partial='true' beanclass='${actionClass}'>
   <s:text name="${baseName}.someproperty"/>
</s:form>
</s:layout-definition>

For rendering them it's as simple as:
<s:form beanclass="someClass.here">
<s:layout-component name="/WEB-INF/jsp/components/fields.jsp" 
baseName="mainPropertyName" actionClass='${actionBean.class}'/>
</s:form>

Of course this is most useful for bunching a lot of fields together like you 
said, but this is the general idea. It works because layouts pass any 'extra' 
attributes you pass in on the tag gets set to a page scope parameter.

Hope this helps!

On Feb 4, 2010, at 3:25 PM, farouk alhassan wrote:

> Thanks All. 
> I understand that stripes is an action based framework and if I want a 
> component based one, I should look for JSF/Seam/or sth like that. 
> 
> However, I am increasingly duplicating my form fields in a lot of places and 
> just changing the name and id attributes. 
> I therefore need to define my form feilds in some way that I can reuse them. 
> I was thinking there is a framework somehere that I can use. 
> 
> The nested Layouts have helped me so far maintain consistency in the site 
> layout without a lot of trouble but duplicating the form feild is making me 
> worried as I know it will be a problem if I have to change the styles or 
> design of the site.
> 
> Thank you
> 
> Regards
> 
> --- On Thu, 4/2/10, Oscar Westra van Holthe - Kind <kin...@xs4all.nl> wrote:
> 
> From: Oscar Westra van Holthe - Kind <kin...@xs4all.nl>
> Subject: Re: [Stripes-users] Stripes and Components
> To: "Stripes Users List" <stripes-users@lists.sourceforge.net>
> Date: Thursday, 4 February, 2010, 20:07
> 
> On 04-02-2010 at 11:47, farouk alhassan wrote:
> > Is it possible to use a component rendering  framework with stripes so I 
> > can reuse predefined components? 
> 
> In short: yes.
> 
> Longer answer: You're combining an action based framework (Stripes) with a
> component rendering framework. This means you should know what request
> attributes the component framework requires to render the components, and what
> the resulting input form fields (and resulting request parameters) will be.
> Knowing this, you can let it play nice with Stripes.
> 
> 
> Oscar
> 
> -- 
>    ,-_  Oscar Westra van Holthe - Kind      http://www.xs4all.nl/~kindop/
>   /() )
> (__ (  Inequality is the inevitable consequence of liberty.
> =/  ()  -- Salvador De Madariaga - "Anarchy or Hierarchy" (1937)
> 
> -----Inline Attachment Follows-----
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com_______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to