Package org.apache.struts2.util
Class StrutsUtil
java.lang.Object
org.apache.struts2.util.StrutsUtil
Struts base utility class, for use in Velocity and Freemarker templates
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStrutsUtil
(ValueStack stack, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
Method Summary
Modifier and TypeMethodDescriptionfindString
(String name) boolean
makeSelectList
(String selectedList, String list, String listKey, String listValue) the selectedList objects are matched to the list.listValueint
toInt
(long aLong) long
toLong
(int anInt) long
toString
(int anInt) toString
(long aLong) toStringSafe
(Object obj) translateVariables
(String expression)
-
Field Details
-
LOG
protected static final org.apache.logging.log4j.Logger LOG -
request
protected jakarta.servlet.http.HttpServletRequest request -
response
protected jakarta.servlet.http.HttpServletResponse response -
classes
-
stack
-
-
Constructor Details
-
StrutsUtil
public StrutsUtil(ValueStack stack, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
-
-
Method Details
-
bean
- Throws:
Exception
-
isTrue
-
findString
-
include
- Throws:
Exception
-
urlEncode
-
buildUrl
-
findValue
- Throws:
ClassNotFoundException
-
findValue
-
getText
-
getContext
-
translateVariables
-
makeSelectList
public List<ListEntry> makeSelectList(String selectedList, String list, String listKey, String listValue) the selectedList objects are matched to the list.listValuelistKey and listValue are optional, and if not provided, the list item is used
- Parameters:
selectedList
- the name of the action property that contains the list of selected items or single item if its not an array or listlist
- the name of the action property that contains the list of selectable itemslistKey
- an ognl expression that is exaluated relative to the list item to use as the key of the ListEntrylistValue
- an ognl expression that is exaluated relative to the list item to use as the value of the ListEntry- Returns:
- a List of ListEntry
-
toInt
public int toInt(long aLong) -
toLong
public long toLong(int anInt) -
toLong
-
toString
-
toString
-
toStringSafe
-