开发者

Stripes does not see my ActionBean

开发者 https://www.devze.com 2023-02-16 03:50 出处:网络
I\'m having again some little problems with Stripes, this time with the link tag Basically i am calling an action bean from a jsp like so:

I'm having again some little problems with Stripes, this time with the link tag Basically i am calling an action bean from a jsp like so:

<s:link beanclass="users.action.UserFormActionBean">...</s:link>

The exception i receive is:

The value supplied for the 'beanclass' attribute does not represent a valid Acti开发者_Python百科onBean.

Which is not true because that class implements ActionBean (via a class helper called BaseActionBean) and it contains a @DefaultHandler.

I really cant figure out why it does not work, below i will post the two classes

public class UserFormActionBean extends BaseActionBean{

private User user;

private static final String FORM="/WEB-INF/jsp/form.jsp";

private static final String LIST="/WEB-INF/jsp/list.jsp";

@DefaultHandler
public Resolution goToForm(){

    return new ForwardResolution(FORM);
}

/**
 * A getter for the user
 * @return
 */
public User getUser(){

    return this.user;
}

/**
 *save the new user into db 
 */
public Resolution save(User user){

    DaoUtil.save(user);

    return new ForwardResolution(LIST);
}

}

the helper:

public class BaseActionBean implements ActionBean{

private ActionBeanContext ctx;

public void setContext(ActionBeanContext ctx){

    this.ctx=ctx;
}

public ActionBeanContext getContext(){

    return this.ctx;
}

}


Check your package declaration for UserFormActionBean it should be:

package users.action;

(Although I would recommend using another package name as this name does not conform to the general Java naming convention that describes that a package name should start with one of the top-level domain names of your organization).

0

精彩评论

暂无评论...
验证码 换一张
取 消