You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by senthil Kumar <se...@tarangtech.com> on 2005/12/06 06:13:45 UTC
Help required in logic:html
Hi All.,
I have a following statements. Here validStatus is the String[] property. It contains the value of " a,b,c,d". I am used Stringtokenizer.
once executing this statement
<logic:iterate name="ProjectListForm" id="abcd" property='<%= "projectListValue["+ctr+"].validStatus" %>' >
<bean:write name="abcd" />
</logic:itwerate>
it is print like " a b c d" .
Now i want to print he same result in drop down (listbox) like one by one.
<html:select name="ProjectListForm" property='<%= "projectListValue["+ctr+"].validStatus" %>' styleClass="projectdetaillist" disabled = "false" >
<html:options name="ProjectListForm" property='<bean:write name="abcd">' />
</html:select>
But it is giving java script error. I cant find out what is the propblem. Can any boy help me.
Thanks in Advance.
Senthil S
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient or received it in error, please contact the sender by reply e-mail and destroy all copies of the original message. Please do not copy it for any purpose or disclose its contents.
Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved
Re: Help required in logic:html
Posted by Laurie Harper <la...@holoweb.net>.
senthil Kumar wrote:
> Hi All.,
>
> I have a following statements. Here validStatus is the String[] property. It contains the value of " a,b,c,d". I am used Stringtokenizer.
Do you mean validStatus is an array of the Strings "a", "b", "c" and
"d", or a string array with one entry "a,b,c,d"? I'll assume you mean
that you used a StringTokenizer to create the 4-element array from the
simple string "a,b,c,d".
> once executing this statement
>
> <logic:iterate name="ProjectListForm" id="abcd" property='<%= "projectListValue["+ctr+"].validStatus" %>' >
> <bean:write name="abcd" />
> </logic:itwerate>
>
> it is print like " a b c d" .
I'm not sure what the projectListValue["+ctr+"] bit is about, but I'll
assume your form bean has an indexed property 'projectListValue and that
the individual elements of that indexed property are beans with a
validStatus property, which is of type String[].
> Now i want to print he same result in drop down (listbox) like one by one.
>
> <html:select name="ProjectListForm" property='<%= "projectListValue["+ctr+"].validStatus" %>' styleClass="projectdetaillist" disabled = "false" >
> <html:options name="ProjectListForm" property='<bean:write name="abcd">' />
> </html:select>
>
> But it is giving java script error. I cant find out what is the propblem. Can any boy help me.
There are several things wrong here. First and foremost, you can't nest
JSP tags that way (i.e. you can't use a JSP tag to set the value of an
attribute on another JSP tag).
Secondly, the bean:write tag is referencing the scripting variable
'abcd', which you're not defining in this case.
Thirdly, you've set the html:select tag's 'property' attribute to point
to a property which (based on the above) is a String array, but you
haven't included multiple="true". Unless you want a multi-select, you
should be pointing to a String property rather than a String array
property here.
I *think* what you're trying to do is something like this:
<html:select property="currentSelection">
<html:options
property='<%="projectListValue["+ctr+"].validStatus"%>'/>
</html:select>
(Note that you don't need to explicitly specify the form with the 'name'
attribute, the html:* tags will automatically use the form bean
associated with the enclosing html:form tag).
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org