Methods Summary |
---|
public java.lang.Object | bean(java.lang.Object aName)
String name = aName.toString();
Class c = (Class) classes.get(name);
if (c == null) {
c = ClassLoaderUtils.loadClass(name, StrutsUtil.class);
classes.put(name, c);
}
return ObjectFactory.getObjectFactory().buildBean(c, stack.getContext());
|
public java.lang.String | buildUrl(java.lang.String url)
return UrlHelper.buildUrl(url, request, response, null);
|
public java.lang.Object | findString(java.lang.String name)
return stack.findValue(name, String.class);
|
public java.lang.Object | findValue(java.lang.String expression, java.lang.String className)
return stack.findValue(expression, Class.forName(className));
|
public java.lang.String | getContext()
return (request == null)? "" : request.getContextPath();
|
public java.lang.String | getText(java.lang.String text)
return (String) stack.findValue("getText('" + text + "')");
|
public java.lang.String | htmlEncode(java.lang.Object obj)
if (obj == null) {
return null;
}
return TextUtils.htmlEncode(obj.toString());
|
public java.lang.String | include(java.lang.Object aName)
return include(aName, request, response);
|
public java.lang.String | include(java.lang.Object aName, javax.servlet.http.HttpServletRequest aRequest, javax.servlet.http.HttpServletResponse aResponse)
try {
RequestDispatcher dispatcher = aRequest.getRequestDispatcher(aName.toString());
if (dispatcher == null) {
throw new IllegalArgumentException("Cannot find included file " + aName);
}
ResponseWrapper responseWrapper = new ResponseWrapper(aResponse);
dispatcher.include(aRequest, responseWrapper);
return responseWrapper.getData();
}
catch (Exception e) {
e.printStackTrace();
throw e;
}
|
public boolean | isTrue(java.lang.String expression)
Boolean retVal = (Boolean) stack.findValue(expression, Boolean.class);
if (retVal == null) {
return false;
}
return retVal.booleanValue();
|
public java.util.List | makeSelectList(java.lang.String selectedList, java.lang.String list, java.lang.String listKey, java.lang.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
List selectList = new ArrayList();
Collection selectedItems = null;
Object i = stack.findValue(selectedList);
if (i != null) {
if (i.getClass().isArray()) {
selectedItems = Arrays.asList((Object[]) i);
} else if (i instanceof Collection) {
selectedItems = (Collection) i;
} else {
// treat it is a single item
selectedItems = new ArrayList();
selectedItems.add(i);
}
}
Collection items = (Collection) stack.findValue(list);
if (items != null) {
for (Iterator iter = items.iterator(); iter.hasNext();) {
Object element = (Object) iter.next();
Object key = null;
if ((listKey == null) || (listKey.length() == 0)) {
key = element;
} else {
key = ognl.findValue(listKey, element);
}
Object value = null;
if ((listValue == null) || (listValue.length() == 0)) {
value = element;
} else {
value = ognl.findValue(listValue, element);
}
boolean isSelected = false;
if ((value != null) && (selectedItems != null) && selectedItems.contains(value)) {
isSelected = true;
}
selectList.add(new ListEntry(key, value, isSelected));
}
}
return selectList;
|
public int | toInt(long aLong)
return (int) aLong;
|
public long | toLong(int anInt)
return (long) anInt;
|
public long | toLong(java.lang.String aLong)
if (aLong == null) {
return 0;
}
return Long.parseLong(aLong);
|
public java.lang.String | toString(long aLong)
return Long.toString(aLong);
|
public java.lang.String | toString(int anInt)
return Integer.toString(anInt);
|
public java.lang.String | urlEncode(java.lang.String s)
try {
return URLEncoder.encode(s, "UTF-8");
} catch (UnsupportedEncodingException e) {
return s;
}
|