gpt4 book ai didi

java - java servlet请求setAttibute和getParameter的问题

转载 作者:行者123 更新时间:2023-11-30 05:58:04 27 4
gpt4 key购买 nike

@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("orden", 11);
System.out.println("ord "+request.getParameter("orden"));//returns null
request.getRequestDispatcher("/view/a.jsp").forward(request, response);
}

//Why does this happen?

在我的jsp中是相同的result = null

最佳答案

您正在设置一个属性并尝试获取一个参数

request.setAttribute("orden", 11);
request.getAttribute("orden");

关于java - java servlet请求setAttibute和getParameter的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52808573/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com