Hello,
you could use FormView for manage your state (readonly, ...) for your input.
With new version of formview you can too manage label to set RED color when
input has ERROR.

You can find FormView Web Site at http://formview.sourceforge.net/
and download JAR at http://sourceforge.net/projects/formview.

Regards Angelo

2006/5/29, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

If I understand what it is you are trying to do. I think you want to write
out
an input field with the name,value and a display property. What I normally
do
for simplicity sake is to create an object to represent a field and it's
properties. In the action class I populate a collection with these objects
setting there appropriate properties. In the jsp page I use a
<logic:iterate>
tag to loop over each object and apply the value of there properties to an
input field. I might use <input type="text" name="<bean:write name="o.name
"
readonly="o.readonly"> where o is the object in each iteration of the
collection.

If it is necessary to write a custom tag, I think I would pass the form
object
to the tag and do all of the html work internally.

Just my $0.02

Bryan LaPlante

---------- Original Message -----------
From: "Hanmay Udgiri" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Mon, 29 May 2006 16:09:08 +0530
Subject: Custom tag

> Hi
> I have 100 fields for a JSP.And in the JSP a field can be
> mandatory/optiobal/read only.
> I am writing a custom tag to display the label bold for mandatory and
non
> bold for optional.
> I am having a indicator for each field and I am passing this indicator
to
> the custom tag.
> I am giving the sample code as below.
>
> In the form bean
> private String field1;
> private String field2;
>
> private boolean field1Indicator;
> private boolean field2Indicator;
> (set and get for all)
>
> In the JSP.
>
> <myTag:indicatorStartDisplay indicatorType='<bean:write name="myForm"
> property="field1Indicator"/>'/>
>                <html:text name="myForm" property="field1"/>
> <myTag:indicatorEndDisplay indicatorType='<bean:write name="myForm"
> property="field1Indicator"/>'/>
>
> <myTag:indicatorStartDisplay indicatorType='<bean:write name="myForm"
> property="field2Indicator"/>'/>
>                <html:text name="myForm" property="field2"/>
> <myTag:indicatorEndDisplay indicatorType='<bean:write name="myForm"
> property="field2Indicator"/>'/>
>
> Here I have two custom tags which writes
> <b> and </b> in between the text field.
>
> As I have 100 field,with this approach I have to have 100 field
indicator.
> Is there any other way to implement this???
>
> --
> Thanks and Regards
> Hanmayya Udgiri
------- End of Original Message -------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to