0

我有两个方法并使用 Spring MVC,首先是方法 = RequestMethod.GET,然后我设置 session.setAttribute("clientId", "abc")。第二种方法是 method=RequestMethod.POST 我这样做:

HttpSession session = request.getSession();
System.out.println("-----" + (String)session.getAttribute("clientId"));

但总是为空。

[编辑]

这里的事情是post方法不是由ModalandView(“postpage”)调用的,它是由Apache oltu内部的Http callout调用的

4

1 回答 1

0

在 Get 方法中做

 Session session = request.getSession(true); 
  session.setAttribute("clientId", "abc");

在邮政做

String s = request.getSession().getAttribute("clientId");
于 2016-09-06T16:38:19.853 回答