Calling static method helper class in Struts2 JSP with Action data model value

前端 未结 2 1736
刺人心
刺人心 2020-12-21 04:50

I\'m a Struts2 newbie. I\'m using Struts2 with the typical datamodel UserItem inside an Action. The datamodel doesn\'t look good when using with the Struts ta

2条回答
  •  轮回少年
    2020-12-21 05:28

    EDIT

    From 2.3.20 and higher, static method access won't work anymore, even if activated in the configuration.


    For static methods access you need:

    in Struts.xml

    
    

    in your JSP

    
    

    But as pointed out by rees, this should be avoided if not strictly necessary, because it's not a best practice.

    In your specific case, i guess the Object containing ["String1","String2",...] is a List, or a Vector, or something like this.

    Then all you need in your JSP is the tag like this:

    
        
       

提交回复
热议问题