Struts 2 bean tag: create and instantiate a JavaBean object
•
Java
< s: bean name = "Fe. ZX. Person" > < s: param name = "username" value = "'Mr '" / > / / sub tag < s: property value = "password" / > < / s: bean >
Example
public class Person{ private String username; private String password; public String getUsername(){ return username; } //省略部分get和set方法 }
<body> //应用bean标签 <s:bean name="fe.zx.Person"> //使用对应的子标签进行参数传递 <s:param name="username" value="'mr'"/> <s:param name="password" value="'mrsoft'"/> 你好!<s:property value="username"/>,您的用户名是:<s:property value="username" /><br>,并请牢记您的密码是:<s:property value="password"/> </s:bean>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码