Stripes does not see my ActionBean
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).
精彩评论