当前位置: 网站首页 > JAVA > j2ee

Struts 2 Bean Tag Example

时间:1970-1-1 08:33:31来源: j2ee作者:admin 点击:7次 字体 [ С]

02.<head>
03.<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
04.<title>Bean Tag Example</title>
05.</head>
06.<body>
07.<s:bean name="vaannila.CurrencyConverter" var="converter">
08.    <s:param name="dollars" value="100"></s:param>
09.</s:bean>
10.100 Dollars = <s:property value="#converter.rupees" /> Rupees
11. 
12.</body>
13.</html>
To create an instance of the bean in the ActionContext we need to specify the instance name using the var attribute of the bean tag. Here our instance name is converter. Once we do this we can access the bean values outside the bean tag. Since the value is in the ActionContext we use the # operator to refer it.
 
You can try the Struts 2 Bean Tag Example by clicking the Download link below. 


发表评论
验证码:
最新评论
相关文章
最热文章