本文整理汇总了Java中com.opensymphony.xwork2.Action.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java Action.ERROR属性的具体用法?Java Action.ERROR怎么用?Java Action.ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.opensymphony.xwork2.Action
的用法示例。
在下文中一共展示了Action.ERROR属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
@Override
public String execute() {
if (!userService.isTokenValid(getServiceContext(), username, token)) {
addFieldError("token", "This username/token combination is not valid.");
} else {
try {
userService.changePassword(getServiceContext(), username, passwordField, confirmPasswordField);
userService.clearTokens(getServiceContext(), username);
} catch (ValidationServiceException e) {
List<ValidationError> errors = e.getFaultInfo().getAttributeErrors();
for (ValidationError validationError : errors) {
addFieldError(validationError.getFieldName(), validationError.getOnlineMessage());
}
}
}
if (hasErrors()) {
return Action.ERROR;
}
return SUCCESS;
}
示例2: findById
public String findById(){
HttpServletRequest request = ServletActionContext.getRequest();
String strId = request.getParameter("id");
if(strId != null && strId.length()> 0){
Integer id = Integer.valueOf(strId);
SysUser sysUser = this.sysUserService.findById(id);
resultMap = new HashMap<String,Object>();
resultMap.put("error", "false");
resultMap.put("status", "ok");
resultMap.put("result", sysUser);
return Action.SUCCESS;
}else{
return Action.ERROR;
}
}
示例3: login
/**
* Performs a login using JAAS / Container authentication. Further the method populates the session
* attribute SUBJECT with a JAAS subject for the user. The subject is either populated from the container
* such as jetty or an additional JAAS login is performed to obtain the subject.
* @return
* SUCCESS if the login was successful, otherwise ERROR is returned.
* @throws Exception
*/
public String login() throws Exception {
if (isInvalid(getUsername())) {
return INPUT;
}
if (isInvalid(getPassword())) {
return INPUT;
}
final HttpServletRequest request = ServletActionContext.getRequest();
final HttpSession session = request.getSession();
//perform container login
try {
request.login(username, password);
} catch(ServletException e){
LOG.error("Login failed", e);
return Action.ERROR;
}
//try to obtain the Subject from the container or perform an _additional_ login
//in order to get the subject.
final Optional<Subject> subject = Stream.of(jettySupport,
new LoginModuleAuthSupport(getUsername(), getPassword()))
.map(f -> f.apply(session))
.findFirst()
.flatMap(identity());
//register the subject in the session so we can obtain it without vendor specific
//access logic (such as Jetty's)
//see RunAsInterceptor where we need this
subject.ifPresent(subj -> session.setAttribute("SUBJECT", subj));
return subject.map(s -> Action.SUCCESS).orElse(Action.ERROR);
}
示例4: intercept
@Override
public synchronized String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
ActionContext ctx=invocation.getInvocationContext();
User user=new User();
user=(User)ctx.getSession().get(SessionContants.USER);
if(user==null){
return Action.ERROR;
}
return invocation.invoke();
}
示例5: intercept
@Override
public synchronized String intercept(ActionInvocation invocation) throws Exception {
ActionContext ctx=invocation.getInvocationContext();
User user=new User();
user=(User)ctx.getSession().get(SessionContants.USER);
if(user==null){
return Action.ERROR;
}
if(!user.getPermition().equals(User.SUPER_PERMITION)){
return Action.ERROR;
}
return invocation.invoke();
}
示例6: intercept
@Override
public synchronized String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
ActionContext ctx=invocation.getInvocationContext();
User user=new User();
user=(User)ctx.getSession().get(SessionContants.USER);
if(user==null){
return Action.ERROR;
}
if(!user.getPermition().equals(User.MODIFY_PERMITION)&&!user.getPermition().equals(User
.SUPER_PERMITION)){
return Action.ERROR;
}
return invocation.invoke();
}
示例7: execute
public String execute(){
IncomeDao incomedao=new IncomeDao();
ActionContext ctx = ActionContext.getContext();
Map<String, Object> session = ctx.getSession();
Parking parking = (Parking) session.get("parking");
System.out.println((income.getPlatnumber()));
System.out.println("00="+parking.getParkid());
income = incomedao.getincomebyplatnumber(income.getPlatnumber(),parking.getParkid());
if(income==null){
addActionMessage("无对应车辆,请检查输入是否正确");
return Action.ERROR;
}
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm");//设置日期格式
//System.out.println("入场时间"+income.getCarin());
Date datein = null;
try {
datein = df.parse(income.getCarin());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Date dateout = new Date();
long temp = dateout.getTime() - datein.getTime(); //相差毫秒数
long hours = temp / 1000 / 3600;//相差小时数
long temp2 = temp % (1000 * 3600);
if(temp2!=0){
hours = hours+1;
}
int price = income.getPark().getPrice();
int money = (int)(price*hours);
String carout = df.format(dateout);
income.setCarout(carout);
income.setMoney(money);
session.put("income", income);
//System.out.println("金额"+money);
return Action.SUCCESS;
}
示例8: doDefault
@Override
public String doDefault() throws Exception {
resultsParamString = "";
List<DeploymentObject> deploymentObjects = null;
final HttpServletRequest request = ServletActionContext.getRequest();
final String rawParams = request.getParameter("params");
if (rawParams != null) {
deploymentObjects = getDeploymentInfoFromParams(rawParams);
}
if (deploymentObjects == null) {
return Action.ERROR;
}
for (DeploymentObject deploymentObject : deploymentObjects) {
// Create deployment context and start deployment
User user = bambooAuthenticationContext.getUser();
EnvironmentTriggeringAction environmentTriggeringAction =
triggeringActionFactory.createManualEnvironmentTriggeringAction(
deploymentObject.getTargetEnvironment(), deploymentObject.getVersion(), user);
ExecutionRequestResult executionRequestResult =
deploymentExecutionService.execute(deploymentObject.getTargetEnvironment(), environmentTriggeringAction);
if (executionRequestResult.getDeploymentResultId() != null) {
DeploymentResult deploymentResult =
deploymentResultService.getDeploymentResult(executionRequestResult.getDeploymentResultId());
deploymentObject.setResult(deploymentResult);
// Generate the response string
resultsParamString += deploymentObject.serialize() + ";";
}
}
return Action.SUCCESS;
}
示例9: findById
public String findById(){
String result = Action.SUCCESS;
HttpServletRequest request = ServletActionContext.getRequest();
String strId = request.getParameter("id");
if(strId != null && strId.length()> 0){
Integer id = Integer.valueOf(strId);
sysUser = this.sysUserService.findById(id);
return result;
}else{
result = Action.ERROR;
}
return result;
}