Struts2 0 11的標籤不支援EL表示式

2021-05-24 12:15:52 字數 525 閱讀 3667

當你使用struts 2 tags時,如果使用**:

" />

或者        

都會發生下列錯誤:

according to tld or attribute directive in tag file, attribute value does not accept any expressions

而得使用:

才行原 因可能是因為你使用了<%..%>** or jsp el表示式。struts 2從 version 2.0.11開始已經不支援 struts tag與jsp el表示式混合使用了(不在struts tag裡使用el還是可以的),而只支援ognl  

對於,是使用

而對於,則要使用(否則出錯):

但是如果使用struts include tag來傳引數,則和無法獲取傳來的引數,如:

scott

那麼在webcome.jsp裡通過和無法獲取"name"引數:

而只能夠用<%request.getparameter("name")%>來獲取

struts的if標籤使用

下面總結一下struts2 中if標籤的使用 1 判斷字串是否為空 s if test user.username null or user.username s if test ab123 null ab123 is null s if s else ab123 not null s else 2...

struts標籤的用法

將user.class,iterate.jsp放到相應的目錄,執行iterate.jsp你就可以看到iterate的效果了 iterate標記 id 指令碼變數的名稱,它儲存著集合中當前元素的控制代碼。name 代表了你需要疊代的集合,來自session或者request的屬性。type 是其中的集...

struts 標籤的用法

使用action標籤,可以允許在jsp頁面中直接呼叫action,在呼叫action時候,可以指定需要被呼叫的action的name和namespace.如果指定了executeresult引數的屬性值為true,該標籤會把action的處理結果 檢視資源 包含到本頁面中.使用action標籤指定屬...