📄 webjsutil.java
字号:
/*
* Created on 2005-4-19
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package cn.myapps.core.dynaform.macro;
import java.util.Collection;
import java.util.Iterator;
import cn.myapps.base.action.ParamsTable;
import cn.myapps.core.dynaform.document.ejb.Document;
import cn.myapps.core.dynaform.form.ejb.ValidateMessage;
import cn.myapps.core.user.action.WebUser;
/**
* @author ZhouTY
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class WebJsUtil {
private Document _doc;
private WebUser _user;
private ParamsTable _params;
private Collection _errors;
public WebJsUtil(Document doc, ParamsTable params, WebUser user,
Collection errors) {
_doc = doc;
_user = user;
_params = params;
_errors = errors;
}
public WebUser getWebUser() {
return _user;
}
public ParamsTable getParamsTable() {
return _params;
}
public Collection getErrors() {
return _errors;
}
public String getErrorMessage() {
String errorMessage = "";
if (_errors != null && _errors.size() > 0) {
errorMessage += "错误信息:";
Iterator iter = _errors.iterator();
while (iter.hasNext()) {
ValidateMessage error = (ValidateMessage) iter.next();
errorMessage += error.getErrmessage() + "\n";
}
}
return errorMessage;
}
public static ParamsTable createParamsTable() {
return new ParamsTable();
}
public String getParameterAsText(String tag) {
String value = _params.getParameterAsText(tag);
return (value == null) ? "" : value;
}
public String getParameterAsString(String tag) {
String value = (String) _params.getParameter(tag);
return (value == null) ? "" : value;
}
public int getParameterAsInteger(String tag) {
String value = (String) _params.getParameter(tag);
int rtn = 0;
if (value != null) {
try {
rtn = Integer.parseInt(value);
} catch (Exception e) {
}
}
return rtn;
}
public long getParameterAsLong(String tag) {
String value = (String) _params.getParameter(tag);
long rtn = 0;
if (value != null) {
try {
rtn = Long.parseLong(value);
} catch (Exception e) {
}
}
return rtn;
}
public int get_currpage() {
String currage = getParameterAsString("_currpage");
return (currage == null || currage.trim().length() <= 0) ? 1 : Integer
.parseInt(currage);
}
public String getApplication() {
String applicationid = _user.getApplicationid();
if (applicationid == null || applicationid.trim().length() <= 0) {
applicationid = this.getParamsTable().getParameterAsString(
"application");
}
return applicationid;
}
public static void main(String[] args) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -