struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Yang <>
Subject [S2] Getting property value from Enum
Date Tue, 26 May 2009 07:06:41 GMT
Hi First of all if this question has been ask, I apologize for the double
post. and please refer me to the reference. thanks

I am using 2.1.6.
I have a Enum class Gender
and it has a method getTextKey() which simply returns a key for me to use in
getText() in Action

If in my Action I have

private Gender gender


then in my jsp if i use
<s:property value="gender.textKey"/>
I get nothing
(toString is not called)

if i use
<s:property value="gender.getTextKey()"/>

I found that it calls toString() first then calls getTextKey() on it and
result in nothing because there is no method called getTextKey on String.

Is this a bug? or am i missing something?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message