<s:fielderror/>
<form action="${pageContext.request.contextPath }/product_add.action" method="post">
商品名:<input type="text" name="name"/><br/>
价格:<input type="password" name="price"/><br/>
<input type="submit" value="登录"/>
</form>
public class ProductAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private String name;
private double price;
public String add(){
System.out.println(name+"---------"+price);
return SUCCESS;
/*
get(),set()方法略去.................
*/
}
}
<!DOCTYPE validators PUBLIC
"-//Apache Struts//XWork Validator 1.0.3//EN"
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
<validators>
<!-- 校验商品 -->
<field name="name">
<field-validator type="requiredstring">
<message key="wc"/>
</field-validator>
</field>
</validators>
<h1><s:i18n name="messages">
<s:text name="cn.wc"></s:text>
</s:i18n></h1>
<s:text name="welcome">
<s:param>lxp</s:param>
</s:text>
public class Product2Action extends ActionSupport {
private static final long serialVersionUID = 1L;
public String add(){
System.out.println(this.getText("welcome",new String[]{"Action"}));
return SUCCESS;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有