在Action定義一個私有屬性并設置set get方法: private String hello="hello silenceper!"; public void setHello(String hello){ this.hello=hello; } public String getHello(){ return hello; }可以在jsp頁面中通過EL表達式和struts2標簽來獲取屬性的值: <s:property value="hello"/> 或者 ${requestScope.hello}但是如果設置屬性為public 并且 不設置set get方法的話,還是可以通過上面兩中方法來獲取。這是為什么?還有就是屬性怎么到requestScope中去了?
struts2中的一個疑惑?
達令說
2019-03-12 13:14:35