Hi,
I'm using: Struts 1.2.7; Tomcat 5.5.25; Java 1.5
I am having a problem using logic:equal in implementing a SELECT
statement on a page.
It should be simple.
The code snippet is this (stripped out scopes to simplify it):
<select name="mobileEmailService" >
<logic:iterate id="item" name="mobileEmailProviders" >
<option value="<bean:write name='item' property='key'/>"
<logic:equal name="configCommsForm"
property="mobileEmailService"
value="<bean:write name='item'
property='key'/>">SELECTED</logic:equal>
>
<bean:write name='item' property='value'/>
</option>
</logic:iterate>
</select
The values of the variable "item" are pairs of Strings, referenced by
'key' and 'value'.
When the page is rendered, the chosen value is available as the value of
configCommsForm.mobileEmailService. The problem is that the select drop
down menu
does not display this value, but always defaults to the first item in
the list of options.
To attempt to determine what's happening, I added a few more data output
statements,
as follows:
<bean:write name="configCommsForm" property="mobileEmailService" /> --
<select name="mobileEmailService" >
<logic:iterate id="item" name="mobileEmailProviders" >
<option value="<bean:write name='item' property='key' />"
<logic:equal name="configCommsForm"
property="mobileEmailService"
value="<bean:write name='item' property='key'
/>">SELECTED</logic:equal>
<logic:notEqual name="configCommsForm"
property="mobileEmailService"
value="<bean:write name='item' property='key'
/>">ZAP</logic:notEqual>
>
<bean:write name='item' property='value' /> [<bean:write
name='item' property='key' />]
</option>
</logic:iterate>
</select
+ Before the SELECT, it now writes out the value of
configCommsForm.mobileEmailService, followed by --.
+ Besides attempting to apply logic:equal, in addition it now attempts
to apply logic:notEqual, and write "ZAP" when that succeeds.
+ After each option entry (<bean:write name='item' property='value' />),
it now writes the corresponding key value
(<bean:write name='item' property='key' />), surrounded by square brackets.
The source of the resulting page fragement is:
ATTWireless --
<select name="mobileEmailService" >
<option value="CingularAndIPhone"
ZAP
>
Cingular (and iPhone) [CingularAndIPhone]
</option>
<option value="ATTWireless"
ZAP
>
AT&T Email Messaging [ATTWireless]
</option>
<option value="Nextel"
ZAP
>
Nextel [Nextel]
</option>
....etc....
Of course, what I want is that for the option "ATTWireless", the "ZAP"
should be "SELECTED".
I can't see what is happening.
Thanks in advance for any help you can give me.
Ken Bowen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]