jsp,OGNL調用後台Action的某方法

來源:互聯網
上載者:User

標籤:blog   io   strong   sp   div   cti   on   c   log   

用%{}可取出valueStack中的Action,可直接調用其方法.

%{testa(‘key‘)} 即可調用到action的testa(String s) 方法 

但這些都需要結合struts2的標籤. 如:<s:property value="%{testa(‘key‘)}" /> key是需要傳的參數,背景testa方法的傳回值是String類型的,key是值, 例如<s:property value="%{testa(#u.tbPriceGreade.priceGreade)}"/> 經過本人實驗,傳回值也可以是list集合,這個時候一般用在遍曆<select> 的時候用的    <s:iterator id="Ids1" value="%{getlistTblSuperPprice(#li.productId)}" status="stat4" >   getlistTblSuperPprice返回的是list集合
如果如果單獨的一個固定的值就得用‘key‘,不過這種固定值情況很少出現,因為沒什麼意義 另外還有一種方式:  <s:property value="@[email protected](#session.tblOrderMYself.categoryId).machineRoomName"/>大家一看就明白了吧

jsp,OGNL調用後台Action的某方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.