Hi all,

I have a couple of questions:
(1). I want to display a combo box with pre selected element shown. I have
something like:

<select name="departmentId">
    <ww:iterator value="departments">
        <ww:if test="<ww:property value='departmentId'/> == <ww:property
value='id'/>"
            <option selected value='<ww:property value="id" />'><ww:property
value="name" /></option>
        </ww:if>
        <option value='<ww:property value="id" />'><ww:property
value="name"/></option>
    </ww:iterator>
</select>

What I'm trying to do is to display a list of departments, where a
previously selected department is shown as first element in the combo box.
Obviously I did something wrong, the code above doesn't work. Printing out
values using property tag is ok. So, how should I go around with this?
'department' has two properties 'id' and 'name' of type Integer and String
respectively.

(2). Suppose I have two object user and department, both have 'id' and
'name' properties. Code like this doesn't seem to work:

<ui:textfield label="User Id" name="userId" value="user.id"/>
<ui:textfield label="Department  Id" name="deptId" value="department.id"/>

<ui:textfield label="User Name" name="userName" value="user.name"/>
<ui:textfield label="Department  Name" name="deptName"
value="department.name"/>

user and department objects are populated in action class' execution method
prior to dispatching to a jsp page for display. However if I have say,
userId, userName, deptId, deptName properties in my action class (+ their
getters/setters), code like this work just fine:

<ui:textfield label="User Id" name="userId"/>
<ui:textfield label="Department  Id" name="deptId"/>

<ui:textfield label="User Name" name="userName"/>
<ui:textfield label="Department  Name" name="deptName"/>

This properly display their values. Is the first part a correct way doing
it? It feels correct, though, but mine doesn't work :(
Suppose I wrap user object into a list, like :
List userList = (new ArrayList()).add(user);
and pass the list into a jsp (via get/setUserList()), how to printout (say
use textfield tag) user's id/name attributes?

Sorry for bothering if these sounded so obvious.

Thanks,
/bernard




-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to