org.apache.struts2.util
类 StrutsUtil

java.lang.Object
  继承者 org.apache.struts2.util.StrutsUtil
直接已知子类:
VelocityStrutsUtil

public class StrutsUtil
extends Object

Struts base utility class, for use in Velocity and Freemarker templates


构造方法摘要
StrutsUtil(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
方法摘要
 Object bean(Object aName)
           
 String buildUrl(String url)
           
 Object findString(String name)
           
 Object findValue(String expression, String className)
           
 String getContext()
           
 String getText(String text)
           
 String include(Object aName)
           
 String include(Object aName, javax.servlet.http.HttpServletRequest aRequest, javax.servlet.http.HttpServletResponse aResponse)
          已过时。 the request and response are stored in this util class, please use include(string)
 boolean isTrue(String expression)
           
 List makeSelectList(String selectedList, String list, String listKey, String listValue)
          the selectedList objects are matched to the list.listValue

listKey and listValue are optional, and if not provided, the list item is used

 int toInt(long aLong)
           
 long toLong(int anInt)
           
 long toLong(String aLong)
           
 String toString(int anInt)
           
 String toString(long aLong)
           
 String toStringSafe(Object obj)
           
 String translateVariables(String expression)
           
 String urlEncode(String s)
           
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

StrutsUtil

public StrutsUtil(com.opensymphony.xwork2.util.ValueStack stack,
                  javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
方法详细信息

bean

public Object bean(Object aName)
            throws Exception
抛出:
Exception

isTrue

public boolean isTrue(String expression)

findString

public Object findString(String name)

include

public String include(Object aName)
               throws Exception
抛出:
Exception

include

public String include(Object aName,
                      javax.servlet.http.HttpServletRequest aRequest,
                      javax.servlet.http.HttpServletResponse aResponse)
               throws Exception
已过时。 the request and response are stored in this util class, please use include(string)

抛出:
Exception

urlEncode

public String urlEncode(String s)

buildUrl

public String buildUrl(String url)

findValue

public Object findValue(String expression,
                        String className)
                 throws ClassNotFoundException
抛出:
ClassNotFoundException

getText

public String getText(String text)

getContext

public String getContext()

translateVariables

public String translateVariables(String expression)

makeSelectList

public List makeSelectList(String selectedList,
                           String list,
                           String listKey,
                           String listValue)
the selectedList objects are matched to the list.listValue

listKey and listValue are optional, and if not provided, the list item is used

参数:
selectedList - the name of the action property that contains the list of selected items or single item if its not an array or list
list - the name of the action property that contains the list of selectable items
listKey - an ognl expression that is exaluated relative to the list item to use as the key of the ListEntry
listValue - an ognl expression that is exaluated relative to the list item to use as the value of the ListEntry
返回:
a List of ListEntry

toInt

public int toInt(long aLong)

toLong

public long toLong(int anInt)

toLong

public long toLong(String aLong)

toString

public String toString(long aLong)

toString

public String toString(int anInt)

toStringSafe

public String toStringSafe(Object obj)