tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piotr Kiraga" <piotr.kir...@gmail.com>
Subject Re: Expression Language in JSP and JasperException
Date Tue, 20 Feb 2007 19:49:39 GMT
> > The problem is that there could be a class that has no property with
> > name result. In another case there could be another class (bean) that
> > has such property (than of course it works fine, but at first case
> > Tomcat throws exception).
> >
> Maybe.... but let's keep debugging simple.  The expression language is
> expecting a class conforming to the JavaBeans standard.  What does the
> class "com.some.packages.action.LoginActionBean" look like?

Here is LoginActionBean class code (like I sad before, there is no
result field, so getter and seter either):

################################################
package com.some.packages.action;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.DontValidate;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.validation.LocalizableError;
import net.sourceforge.stripes.validation.Validate;

import com.some.packages.util.Global;
import com.some.packages.util.SessionManager;
import com.some.packages.vo.UserVO;

/**
 * @author Piotr Kiraga
 * @since 2007-02-15 12:13:06
 */
public class LoginActionBean implements ActionBean {

	private ActionBeanContext context;
	private String forwardSuccess = "/calculator.jsp";
	private String forwardFail = "/index.jsp";
	
	@Validate(required=true, mask="^.{4,8}$") private String userName;
	@Validate(required=true, mask="^.{1,8}$") private String password;

	/* execute *************************************************************************/
	
	/*
	 * Handler method.
	 * Handles default action.
	 */
	@DefaultHandler
	@DontValidate
	public Resolution init() {
		return new ForwardResolution(forwardFail);
	}
	
	/*
	 * Handler method.
	 * Handles login action.
	 */
	public Resolution login() {
		if ( SessionManager.authorize(getContext(), getUserName(), getPassword()) ) {
			return new ForwardResolution(forwardSuccess);
		}
		else {
			this.getContext().getValidationErrors().addGlobalError(new
LocalizableError("login.error.invalidUserOrPass", userName));
			return init();
		}
	}

	/* validation **********************************************************************/
	
	/* getters and setters
*************************************************************/
	
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public ActionBeanContext getContext() {
		return context;
	}

	public void setContext(ActionBeanContext context) {
		this.context = context;
	}

}
################################################


Regards,

-- 
Piotr Kiraga

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message