无法从jsp中获取struts 2中的参数...为什么?

时间:2013-01-19 19:37:37

标签: jsp struts2

我正在尝试使用下一个网址执行操作

http://localhost:8080/FantasticWebsite/services/addPhone?id=6

所以我的参数对象必须至少具有值为“6”的键“id”,但是没有!,我在表单中获取所有参数,但该ID不会出现。

我得到参数:

id=Integer.parseInt(parameter.get("id")[0]);

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

使用

String id = getRequest().getParameter("id");

其中

    protected HttpServletRequest getRequest() {
        return ServletActionContext.getRequest();
    }