1
name 一般是指 request中的属性
因此在request中设置
request.setAttribute("authListResult", authList);
<logic:iterate name="authListResult" id="userInfo" indexId="index">
id指 集合中 遍历时 当前的id 相当于在request中添加一个attribute
可以在 jsp中 直接用name使用
<bean:write name="userInfo" property="fullName" />
2
property指定值 labelProperty指定显示的项 crmSizeCode 指定选择结果保存的String[] 或者 String (多选/单选)
<html:select property="crmSizeCode" >
<html:options property="crmSizeIds" labelProperty="crmSizeNames"/>
</html:select>
crmSizeCode crmSizeIds crmSizeNames 都是指request中的一个属性
3 自定义一个Exception , 并使用key来输出 国际化信息
public class ErrorException extends Exception {
private String errorCode;
public WorkflowException() {
super();
}
public WorkflowException(String errorCode) {
super();
this.errorCode = errorCode;
}
public String getErrorCode(){
return this.errorCode;
}
public String getErrorMessage(){
return WFMessageUtil.getMessage(this.errorCode);
}
}
public class WFMessageUtil {
private static ResourceBundle messageBundle ;
static{
messageBundle = ResourceBundle.getBundle("WFmessage");//WFmessage:国际化文件
}
public static String getMessage(String errorCode){
return messageBundle.getString(errorCode);
}
}
本文介绍了如何在Struts框架中使用request对象进行数据传递,包括设置和获取属性的方法;展示了如何利用html标签进行表单选择操作,并解释了相关属性的作用;此外还提供了一个自定义异常的例子,该异常可以通过国际化配置文件输出错误信息。
411

被折叠的 条评论
为什么被折叠?



