开发者

how to set a value to <s:hidden > from the action class without using list and iterator in struts 2?

In action class i am reading value from the database. Let's say "abc".Now the "abc" value should be populated to jsp page.i.e "abc" value should set to s:hidden field in the jsp page. Since it is single value , i don't want to use List in the a开发者_高级运维ction class. Is there any other way to do that ?


Why would you want to use a list? Just provide the appropriate getter like:

public Object getAbc(){
   return abc;
}

and in your page access it with simple OGNL expression like:

<s:hidden name="filedYouWantToSetThisValueTo" value="%{abc}"/>

Hope I got it right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜