Yes the select code was meant to be a generic select where I can just bung it
in the struts.xml for different Action classes that has the values for
fieldName, list (vector of object), listKey, listValue so that I can just
make select dropdowns without making more coding. So when I make assorted
form pages which has a dog dropdown for example I can put in field name
required for that form dogId or altDogId and it would use the same action to
generate the dropdown.

Here my DogAction as an example.
http://www.nabble.com/file/p19153375/DogAction.java DogAction.java 

Here's my dog object.
http://www.nabble.com/file/p19153375/Dog.java Dog.java 

And my action config in struts.xml:
<package name="pet" extends="petshop" namespace="/pet">
        <action name="dog_select" method="doGetList"
class="com.petshop.struts.actions.DogAction">
            Dog
            id
            name
            false
            <result type="tiles">widget.generic_select</result>
        </action>
</package>

Then I can all it like this:
https://localhost/petshop/pet/dog_select.do?fieldName=dogId&defaultValue=0&defaultName=All&required=false&theme=filter&debug=console

Here is my generic_select.jsp that used to work in struts 2.0.9:
<%@ taglib prefix="s" uri="/struts-tags" %>

<s:if test="param.fieldName" >
    <s:if test="multiple" >
        <s:select name="${param.fieldName}"
              list='list'
              listKey='${listKey}'
              listValue='${listValue}'
              multiple='true'
              onchange="dojo.event.topic.publish('${param.fieldName}',
{dropdown:this})"
              size='8'
              required="${param.required}"
        />
    </s:if>
    <s:else>
        <s:select name="${param.fieldName}"
              list='list'
              listKey='${listKey}'
              listValue='${listValue}'
              headerKey="${param.defaultValue}"
              headerValue="${param.defaultName}"
              onchange="dojo.event.topic.publish('${param.fieldName}',
{dropdown:this})"
              required="${param.required}"
        />
    </s:else>
</s:if>
<s:else>
    <s:select name="${fieldName}"
          label="${label}"
          list='list'
          listKey='${listKey}'
          listValue='${listValue}'
          headerKey="${param.defaultValue}"
          headerValue="${param.defaultName}"
          onchange="dojo.event.topic.publish('${fieldName}',
{dropdown:this})"
          required="${param.required}"
          theme="${param.theme}"
        />
</s:else>

And finally my tile.xml setting for generic select:
<definition name="widget.generic_select"
template="/tiles/generic_select.jsp"/>
-- 
View this message in context: 
http://www.nabble.com/Struts-2.0.11-from-2.0.9-EL-Expression-problem-tp19100876p19153375.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to