i can only get the Enum working when i have a
setMyCoolEnum(String stringEnum){
if(stringEnum.equals(MyCoolEnum.bla1.toString())){
this.myCoolEnum=MyCoolEnum.bla1;
}else{
this.myCoolEnum=MyCoolEnum.bla2;
}
}
this, nice pice of code, will not work....
setMyCoolEnum(MyCoolEnum myCoolEnum){
this.myCoolEnum=myCoolEnum;
}
should it work like this??
tibi
tibi wrote:
> just to make this complete:
>
> <s:select name="subscriber.domain" label="domain" list="domainList"
> listValue="%{getText('domain.'+toString())}"/>
>
> but i get an error:
> Invalid field value for field "subscriber.domain".
>
> tibi
>
>
> sarat.pediredla wrote:
>
>> I have a s:select form element in my JSP that gets a list of enums to display
>> in a drop down box.
>>
>> The following is my enum
>>
>> public enum Colour {
>> WHITE,
>> RED,
>> BLACK;
>> }
>>
>> The following is the action method that returns a List for my s:select
>>
>> public List getColourList() {
>> return Arrays.asList(Colour.values());
>> }
>>
>> The following is my JSP
>>
>> <s:select
>> name="frmColour"
>> label="colour"
>> list="colourList"
>> />
>>
>> This works fine and the drop down list has the values from the enum.
>>
>> However, I want to be able to use localised string values for each enum
>> value (ex. blanc for WHITE viz. french).
>>
>> I cant figure out how to get Struts 2 to grab these from the
>> ApplicationResources.properties file.
>>
>> Can I even localise the content from enums in s:select at the JSP
>> (presentation) layer?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]