java ee500错误_无法访问页面,500错误
想問下這是怎么回事,明明跟著視頻一步步敲代碼的
相關配置和代碼
web.xml:<?xml ?version="1.0"?encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee?http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
shiroFilter
org.springframework.web.filter.DelegatingFilterProxy
shiroFilter
/*
login.jsp
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring/spring-*.xml
springmvc
/
spring-web.xml:<?xml ?version="1.0"?encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
/login.jsp?=?anon
/subLogin?=?anon
/*?=?authc
login.jsp:
Created?by?IntelliJ?IDEA.
User:?98184
Date:?2019/9/27
Time:?9:08
To?change?this?template?use?File?|?Settings?|?File?Templates.
--%>
登錄用戶名:
密碼:
UserController.java:package?com.lgq.shirotest.controller;
import?com.lgq.shirotest.entity.User;
import?org.apache.shiro.SecurityUtils;
import?org.apache.shiro.authc.AuthenticationException;
import?org.apache.shiro.authc.UsernamePasswordToken;
import?org.apache.shiro.subject.Subject;
import?org.springframework.stereotype.Controller;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.bind.annotation.RequestMethod;
import?org.springframework.web.bind.annotation.ResponseBody;
@Controller
public?class?UserController?{
@RequestMapping(value?=?"/subLogin",?method?=?RequestMethod.POST,produces?=?"application/json;charset=utf-8")
@ResponseBody
public?String?subLogin(User?user)?{
Subject?subject=?SecurityUtils.getSubject();
UsernamePasswordToken?token=new?UsernamePasswordToken(user.getUsername(),user.getPassword());
try?{
subject.login(token);
}?catch?(AuthenticationException?e)?{
return?e.getMessage();//返回異常信息
}
return?"登錄成功";
}
}
總結
以上是生活随笔為你收集整理的java ee500错误_无法访问页面,500错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java list接口方法_java L
- 下一篇: im4java profile_Grap