SpringMVC如何往前台传递参数

2025-06-07 01:35:32

1、package web.controller;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpSession;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;@Controllerpublic class HomeController { @RequestMapping(value = "home", method = RequestMethod.GET) public String home(HttpSession session,HttpServletRequest request) { session.setAttribute("a", 1); request.setAttribute("b", 2); return "home"; }}

SpringMVC如何往前台传递参数
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
相关推荐
猜你喜欢