需求是这样:前台页面,显示的内容项,需要通过读取的配置文件决定.如果配置文件写:
sex 我就显示一个下拉框
如果写:
name 我就显示一个文本框然后我写了一个map对应Map<String, String> strutsLib = new HashMap();
strutsLib.put("sex ", "<bean:message key='lb.sex'/> <html:select property="selected"><html:options name="infoForm" property="values" labelProperty="labels"/></html:select>");strutsLib.put("name", "<bean:message key='lb.name/><html:text property="name"></html:text>");
然后读取配置文件,
String []configFile = {"sex","name"};//遍历配置文件返回String 数组
String conent = null;
for(String cF:configFile)
 conent+=strutsLib.get(cF);
request.setAttribute("conent", conent);
然后在Jsp页面上获取conent
<%
out.println(conent);
%>结果这样写struts标签都不显示