public class Person {
private int id ;
private String Name ;
public int getId() {
return id;
}
public Person(int id, String name) {
super();
this.id = id;
Name = name;
}
public Person() {
super();
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
}
@Override
public String execute() throws Exception {
//application
Person p = new Person(1,"zhangsan") ;
ActionContext.getContext().getApplication().put("person", p);
//session
Person p1 = new Person(3,"wangwu");
ActionContext.getContext().getSession().put("person", p1);
//request
Person p2 = new Person(2,"lisi");
ActionContext.getContext().put("person", p2) ;
//servletContext
Person p3 = new Person(5,"xiaoming");
ActionContext.getContext().getContextMap().put("person", p3);
Person p4 = new Person(3,"wangwu");
ActionContext.getContext().getValueStack().push(p4);
return "success";
}
person: <input type="text" name="name" value="${person }" /><br />
id: <input type="text" name="name" value="${person.id }" /><br />
name: <input type="text" name="name" value="${person.name }" /><br />
<hr>
<s:textfield name="person.name"></s:textfield>
<input type="text" name="persom.name" id="person.name" value="<s:property value="#person.name"/>" />
<s:form action="user_%{ id == 0 ? 'add' : 'update' }"></form>
<s:if test="%{false}">
<div>Will Not Be Executed</div>
</s:if>
<s:elseif test="%{true}">
<div>Will Be Executed</div>
</s:elseif>
<s:else>
<div>Will Not Be Executed</div>
</s:else>
public class Stduent implements java.io.Serializable{
private static final long serialVersionUID = -691038814755396419L;
private int id ;
private String name ;
private int score ;
private String subject ;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
/**
* 此处判断成绩是否及格
* @param socre
* @return
*/
public boolean isPast(int socre){
return getScore() > 60 ;
}
}
<s:iterator value="#allUser">
<!-- 判断是否过线,过线即输出,否则舍去! -->
<s:if test="#session.user.isPast(score)">
name: <s:textfield name="name"></s:textfield>
score: <s:textfield name="score"></s:textfield>\
subject:<s:textfield name="subject"></s:textfield>
</s:if>
</s:iterator>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有