Hi everybody! (Quote Dr. Nick)

I've spent the last couple of hours trying to get STRUTS to pre-select an entry in my html:select menu.

Here's the code:

...
<bean:define id="test"
name="PostFormBean"
property="topicInfo" type="java.util.Vector"/>

<bean:define id="currentId"
name="PostFormBean"
property="topicId"
type="Integer"/>
...

<html:select
property="newTopicId"
value="<%=currentId%>"
size="1">

<html:options
collection="test"
property="id"
labelProperty="descr"/>

</html:select>

This does not work - though I couldn't really understand why. Then after some searching with Google, some swearing and 2 hours later I tried to pass the value attribute a string - like this:

<html:select
property="newTopicId"
value="<%=currentId.toString()%>"
size="1">

AND IT WORKED! Can ANYBODY please explain, why it wouldn't accept an Integer but DOES accept a String and why this isn't mentioned anywhere?

Regards,

Tom


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

Reply via email to