struts2找不到action之unknown location

There is no Action mapped for namespace / and action name XXXXX. - [unknown location]

请检查你的xxxAction类的方法是类型是否写成了private!!!

@Action(value="doaddpost",results={
@Result(name="success",type="redirectAction",params={"actionName","postcontent","namespace","/post","postcontentid","${postcontentid}","postid","${postid}"}),
})
public String doaddpost() {
    Postcontent pc = new Postcontent();
    pc.setContent(text);
    pc.setLikenum(0);
    postcontentid = postcontentService.save(pc).toString();
    Post post = new Post();
    post.setTitle(title);
    post.setCreatetime(DateUtil.now());
    post.setPostdiscussnum(0);
    post.setUser((User)getSession().get("user"));
    postid = postService.save(post).toString();
    return SUCCESS;
}


你可能感兴趣的:(location,unknown)