我用以下方法创建了一个动作:
public class NomenclatureAction extends ActionSupport {
// ...
@Actions({
@Action(value = "ajaxDoStuff",
results = {
@Result(name = ActionSupport.SUCCESS, location = "success.jsp"),
@Result(name = ActionSupport.INPUT, location = "fail.jsp")
}),
@Action(value = "index.action",
results = {
@Result(name = ActionSupport.SUCCESS, location = "success.jsp"),
@Result(name = ActionSupport.INPUT, location = "fail.jsp")
})
})
public final String doStuff() {
// ...
return ActionSupport.SUCCESS;
}
}
我想使用以下网址之一调用相同的方法doStuff
:
到目前为止,它适用于前两个网址,但不适用于最后两个网址 我错过了什么?
答案 0 :(得分:1)
value
属性不应包含扩展名。
@Action(value = "index.action",
results = {
@Result(name = ActionSupport.SUCCESS, location = "success.jsp"),
@Result(name = ActionSupport.INPUT, location = "fail.jsp")
})
你也可以尝试http://my-server.com/public/namespace
,它应该由约定的uknown处理程序处理,默认情况下已启用。