You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vencent Chen <ve...@gmail.com> on 2007/12/12 16:27:12 UTC
Enum conversion problem
Hi,all!
I am testing the Struts Showcase 2.0.11.
With the Java 5 Enum conversion, I think the checkboxlist 's list
property availableOperations just come from OperationsEnumAction's
getAvailableOperations() method. So I change the name availableOperations
to availableOperation .But it show error:The requested list
selectedOperations key %{availableOperations} could not be resolved as a
collection/array/map/enumeration/iterator type.......
Ordinary Code:
public List<OperationEnum> getAvailableOperations() {
return Arrays.asList(OperationEnum.values());
}
<s:checkboxlist label="Operations"
name="selectedOperations"
list="%{availableOperations}"
listKey="name()"
listValue="name()"
/>
Changed:
public List<OperationEnum> getAvailableOperation() {
return Arrays.asList(OperationEnum.values());
}
<s:checkboxlist label="Operations"
name="selectedOperations"
list="%{availableOperation}"
listKey="name()"
listValue="name()"
/>
It seems so stupid to do so.But at the beginning ,I just can't find
where the availableOperations come from.Then I found it into Action
class.So I think this would run correctly.But it doesn't.
Could any body explain it to me,please?
--
Vincent CHen
Re: Enum conversion problem
Posted by Vencent Chen <ve...@gmail.com>.
Ok,I'll check it out!
On Dec 13, 2007 4:47 AM, Laurie Harper <la...@holoweb.net> wrote:
> Vencent Chen wrote:
> > Hi,all!
> > I am testing the Struts Showcase 2.0.11.
> > With the Java 5 Enum conversion, I think the checkboxlist 's list
> > property availableOperations just come from OperationsEnumAction's
> > getAvailableOperations() method. So I change the name
> availableOperations
> > to availableOperation .But it show error:The requested list
> > selectedOperations key %{availableOperations} could not be resolved as a
> > collection/array/map/enumeration/iterator type.......
> > Ordinary Code:
> > public List<OperationEnum> getAvailableOperations() {
> > return Arrays.asList(OperationEnum.values());
> > }
> > <s:checkboxlist label="Operations"
> > name="selectedOperations"
> > list="%{availableOperations}"
> > listKey="name()"
> > listValue="name()"
> > />
> > Changed:
> > public List<OperationEnum> getAvailableOperation() {
> > return Arrays.asList(OperationEnum.values());
> > }
> > <s:checkboxlist label="Operations"
> > name="selectedOperations"
> > list="%{availableOperation}"
> > listKey="name()"
> > listValue="name()"
> > />
> > It seems so stupid to do so.But at the beginning ,I just can't find
> > where the availableOperations come from.Then I found it into Action
> > class.So I think this would run correctly.But it doesn't.
> > Could any body explain it to me,please?
>
> Unless I'm also missing the obvious, that should work fine, so I would
> suggest checking that you didn't make a mistake somewhere in the process
> of re-compiling and re-deploying the webapp, since that error would be
> consistent with running the updated JSP against the original action code.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Vincent CHen
Re: Enum conversion problem
Posted by Laurie Harper <la...@holoweb.net>.
Vencent Chen wrote:
> Hi,all!
> I am testing the Struts Showcase 2.0.11.
> With the Java 5 Enum conversion, I think the checkboxlist 's list
> property availableOperations just come from OperationsEnumAction's
> getAvailableOperations() method. So I change the name availableOperations
> to availableOperation .But it show error:The requested list
> selectedOperations key %{availableOperations} could not be resolved as a
> collection/array/map/enumeration/iterator type.......
> Ordinary Code:
> public List<OperationEnum> getAvailableOperations() {
> return Arrays.asList(OperationEnum.values());
> }
> <s:checkboxlist label="Operations"
> name="selectedOperations"
> list="%{availableOperations}"
> listKey="name()"
> listValue="name()"
> />
> Changed:
> public List<OperationEnum> getAvailableOperation() {
> return Arrays.asList(OperationEnum.values());
> }
> <s:checkboxlist label="Operations"
> name="selectedOperations"
> list="%{availableOperation}"
> listKey="name()"
> listValue="name()"
> />
> It seems so stupid to do so.But at the beginning ,I just can't find
> where the availableOperations come from.Then I found it into Action
> class.So I think this would run correctly.But it doesn't.
> Could any body explain it to me,please?
Unless I'm also missing the obvious, that should work fine, so I would
suggest checking that you didn't make a mistake somewhere in the process
of re-compiling and re-deploying the webapp, since that error would be
consistent with running the updated JSP against the original action code.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org