java - Calling a method from action class in .JSP file that takes an Enum parameter in Struts 2 -
i'm using struts 2 framework. have action class , jsp page. class has following 2 methods:
public string foo(string s) { return s + s; } public string bar(someenumclass enumtype) { switch(enumtype) { //return string depending on type. } }
i can call first method using in .jsp file:
<s:property value="%{foo('some string here')}"/>
and correctly return .jsp:
some string heresome string here
i'm trying figure out how call second method. how can let struts 2 know "string" enumtypea
should typecasted corresponding enumtype
?
<s:property value="%{bar('enumtypea')}"/>
struts offers lot of built-in type conversion, string enum
doesn't appear 1 of them?
you can access enum jsp using following notation:
<s:property value="bar(@package.someenumclass@enumtypea)"/>
Comments
Post a Comment