1 如何将数据或对象发送到网页中去
之前用STRUTS1.2开发网站.当我要将对象或数据发布到网页中是用request.setAttribute("myList",myList); 方式发送到网页中. 现在"SH"时也是就这种方式将LIST发送到网页中?2 我怎么都没有从ACTION中读取出stuts.propertise的值 例在中有stuts.propertise中有 myPhotoPath=images/upload/ 此时我在ACTION 中的execute()方法里怎么去取 myPhotoPath的值3 在applicationContext.xml中的${}这个是怎么回事,怎么得来的.
<property name="maxIdleTime">
<value>${c3p0.maxIdleTime}</value>
</property>
像上面这个,${c3p0.maxIdleTime}他的值是动态的,具体方式是怎么工作的?
4 不知道是不是我配置有问题还是有什么,在页里面我用${}这种方式得不到值只能用#request.XXX方式.但
之前用STRUTS1.2开发网站.当我要将对象或数据发布到网页中是用request.setAttribute("myList",myList); 方式发送到网页中. 现在"SH"时也是就这种方式将LIST发送到网页中?2 我怎么都没有从ACTION中读取出stuts.propertise的值 例在中有stuts.propertise中有 myPhotoPath=images/upload/ 此时我在ACTION 中的execute()方法里怎么去取 myPhotoPath的值3 在applicationContext.xml中的${}这个是怎么回事,怎么得来的.
<property name="maxIdleTime">
<value>${c3p0.maxIdleTime}</value>
</property>
像上面这个,${c3p0.maxIdleTime}他的值是动态的,具体方式是怎么工作的?
4 不知道是不是我配置有问题还是有什么,在页里面我用${}这种方式得不到值只能用#request.XXX方式.但
ServletActionContext.getRequest().setAttribute("myList", myList);2 我以前也从来没有从ACTION中读取出stuts.propertise的值,因为一直不需要。
但是需要这么做的话,可以这样(不知道有没有更简单的方法,反正以下代码绝对可行):
InputStream in = this.getClass().getResourceAsStream("/struts.properties");
Properties props = new Properties();
props.load(in);
in.close();
String myPhotoPath = props.getProperty("myPhotoPath");3 在applicationContext.xml中的${},这个是从一个.properties文件中取相应的属性。
详见:http://hi.baidu.com/zhongludeng/blog/item/a575a719a805b74143a9ad82.html4 貌似是存在冲突吧?使用Struts2的时候,会在web.xml中写个配置,把EL给禁用了。你检查一下你的web.xml,看看是不是这么回事。禁用就禁用吧,OGNL比EL强多了,完全可以取代EL,呵呵。