java信息修改代码_根据提⽰信息怎么来修改代码,菜鸟⼀
个,求⼤神帮助?
controller 代码
@Controller
@SessionAttributes("scuser")
public class StudentController {
@Autowired
private IScService scService;
@Autowired
private IStudentService studentService;
@RequestMapping("to_register.do")
public ModelAndView toRegister(ModelMap model)
{
ScUser scuser=new ScUser();
model.addAttribute("scuser",scuser);
return new ModelAndView("register.jsp",model);
}
@RequestMapping(value="register.do",method=RequestMethod.POST)
public String register(@ModelAttribute("scuser") ScUser scuser,RedirectAttributes attr)
{
try{
ister(scuser);
}
catch(ConstraintViolationException e){
return "redirect:to_register.do";
}
return "redirect:main.jsp";
}
session怎么记忆}
注册页⾯
pageEncoding="UTF-8"%>
Insert title here
⽤户名:
密码:
学号:${errorMessage}
测试页⾯(测试注册是否成功
)
pageEncoding="UTF-8"%>
Insert title here
错误信息提⽰
HTTP Status 500 - Session attribute 'scuser' required - not found in
session
type Exception report
message Session attribute 'scuser' required - not found in
session
description The server encountered an internal error that prevented
it from fulfilling this request.
exception
org.springframework.web.HttpSessionRequiredException: Session attribute 'scuser' required - not found in session
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.raiseSessio
org.springframework.web.bind.annotation.solveModelAttribute(HandlerMethodInvoker.java:76
org.springframework.web.bind.annotation.solveHandlerArguments(HandlerMethodInvoker.jav
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:17
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodH
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:822)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:233)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) note The full stack trace of the root cause is available in the
Apache Tomcat/7.0.39 logs

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。