l老师,出现个500的错误
Filter
package com.imooc.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebFilter("/AuthFilter") public class AuthFilter implements Filter { public AuthFilter() { } public void destroy() { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest hrequest=(HttpServletRequest) request; HttpServletResponse hresponse=(HttpServletResponse) response; String loginUser=(String) hrequest.getSession().getAttribute("loginUser"); if(loginUser==null) { hresponse.sendRedirect(hrequest.getContextPath()+"/login.jsp?flag=1"); return; }else { chain.doFilter(request, response); return; } } public void init(FilterConfig fConfig) throws ServletException { } }
package com.imooc.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; @WebFilter("/EncodeFilter") public class EncodeFilter implements Filter { private FilterConfig config; public EncodeFilter() { } public void destroy() { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.setCharacterEncoding(config.getInitParameter("charset")); chain.doFilter(request, response); } public void init(FilterConfig config) throws ServletException { this.config=config; } public FilterConfig getConfig() { return config; } public void setConfig(FilterConfig config) { this.config = config; } }
mainclass
package com.imooc.mainclass; public class Book { private String bookId; private String bookName; private String categoryBook; private Float price; private String path; private String description; public Book() { super(); } public Book(String bookId, String bookName, String categoryBook, Float price, String path, String description) { super(); this.bookId = bookId; this.bookName = bookName; this.categoryBook = categoryBook; this.price = price; this.path = path; this.description = description; } public String getBookId() { return bookId; } public void setBookId(String bookId) { this.bookId = bookId; } public String getBookName() { return bookName; } public void setBookName(String bookName) { this.bookName = bookName; } public String getCategoryBook() { return categoryBook; } public void setCategoryBook(String categoryBook) { this.categoryBook = categoryBook; } public Float getPrice() { return price; } public void setPrice(Float price) { this.price = price; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public String toString() { return "Book [bookId=" + bookId + ", bookName=" + bookName + ", categoryBook=" + categoryBook + ", price=" + price + ", path=" + path + ", description=" + description + "]"; } }
package com.imooc.mainclass; public class Category { private String categoryId; private String categoryName; public Category() { super(); } public Category(String categoryId, String categoryName) { super(); this.categoryId = categoryId; this.categoryName = categoryName; } public String getCategoryId() { return categoryId; } public void setCategoryId(String categoryId) { this.categoryId = categoryId; } public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } @Override public String toString() { return "Category [categoryId=" + categoryId + ", categoryName=" + categoryName + "]"; } }
package com.imooc.mainclass; public class User { private String username; private String password; public User() { } public User(String username, String password) { super(); this.username = username; this.password = password; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String toString() { return "User [username=" + username + ", password=" + password + "]"; } }
service
package com.imooc.service; import com.imooc.mainclass.Category; import com.imooc.service.impl.CategoryServiceImpl; public interface CategoryService { public void addCategory(String categoryId, String categoryName); public Category check(Category category); public void deleteCategory(String categoryId); }
package com.imooc.service; import java.util.List; import com.imooc.mainclass.User; public interface UserService { User login(List<User> userList, User user); }
serviceImpl
package com.imooc.service.impl; import java.util.ArrayList; import java.util.List; import com.imooc.mainclass.Category; import com.imooc.service.CategoryService; public class CategoryServiceImpl implements CategoryService { private static final List<Category> categoryDb = new ArrayList<Category>(); public void addCategory(String categoryId, String categoryName) { categoryDb.add(new Category(categoryId, categoryName)); } public void deleteCategory(String categoryId) { Category cgy = null; for (Category category : categoryDb) { if (category.getCategoryId().equals(categoryId)) { cgy = category; } } categoryDb.remove(cgy); } @Override public Category check(Category category) { for (Category existCategory : categoryDb) { if (existCategory.getCategoryId().equals(category.getCategoryId()) || existCategory.getCategoryName().equals(category.getCategoryName())) { return existCategory; } } return null; } }
package com.imooc.service.impl; import java.util.List; import com.imooc.mainclass.User; import com.imooc.service.UserService; public class UserServiceImpl implements UserService { @Override public User login(List<User> userList, User user) { for(User existUser:userList) { if(existUser.getUsername().equals(user.getUsername())&&existUser.getPassword().equals(user.getPassword())) { return existUser; } } return null; } }
utils
package com.imooc.utils; import java.util.UUID; public class UploadUtils { public static String getUuidFileName(String fileName) { int idx=fileName.lastIndexOf("."); String exName=fileName.substring(idx); String UUidFileName=UUID.randomUUID().toString().replace("-", "")+exName; return UUidFileName; } }
Listener
package com.imooc.web.listener; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; import com.imooc.mainclass.User; @WebListener public class InitServletContextListener implements ServletContextListener { public InitServletContextListener() { } public void contextDestroyed(ServletContextEvent sce) { } public void contextInitialized(ServletContextEvent sce) { //创建一个用于保存用户信息的List集合 List<User> userList=new ArrayList<User>(); userList.add(new User("admin","123456")); userList.add(new User("user","654321")); userList.add(new User("aaa","123123")); userList.add(new User("bbb","456456")); userList.add(new User("ccc","123456")); sce.getServletContext().setAttribute("userList", userList); } }
servlet
package com.imooc.web.servlet; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import com.imooc.mainclass.Book; import com.imooc.utils.UploadUtils; @WebServlet("/addBookServlet") public class addBookServlet extends HttpServlet { private static final long serialVersionUID = 1L; public addBookServlet() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map<String,String> map=new HashMap<String,String>(); //创建磁盘文件项工厂 DiskFileItemFactory diskFileItemFactory=new DiskFileItemFactory(); //创建核心解析类 ServletFileUpload fileUpload=new ServletFileUpload(diskFileItemFactory); //解析请求对象,将请求分成几个部分FileItem try { List<FileItem> list=fileUpload.parseRequest(request); //遍历集合,获得各个部分的对象 for(FileItem fileItem:list) { if(fileItem.isFormField()) { String name=fileItem.getName(); String value=fileItem.getString("UTF-8"); map.put(name, value); }else { String fileName=fileItem.getName(); String uuidFileName=UploadUtils.getUuidFileName(fileName); InputStream is=fileItem.getInputStream(); String path=getServletContext().getRealPath("/upload"); String url= path+"\\"+uuidFileName; map.put("path", request.getContextPath()+"/upload"+uuidFileName); OutputStream os=new FileOutputStream(url); int len=0; byte[] b=new byte[1024]; while((len=is.read(b))!=-1) { os.write(b, 0, len); } is.close(); os.close(); } } } catch (FileUploadException e) { // TODO Auto-generated catch block e.printStackTrace(); } Book book=new Book(); book.setBookId(map.get("bookId")); book.setBookName(map.get("bookName")); book.setCategoryBook(map.get("categoryId")); book.setPrice(Float.parseFloat(map.get("bookPrice"))); book.setDescription(map.get("remarks")); book.setPath(map.get("path")); response.sendRedirect(request.getContextPath()+"/bookList.jsp"); } }
package com.imooc.web.servlet; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.imooc.mainclass.Category; import com.imooc.service.CategoryService; import com.imooc.service.impl.CategoryServiceImpl; @WebServlet("/addCategoryServlet") public class addCategoryServlet extends HttpServlet { private static final long serialVersionUID = 1L; public addCategoryServlet() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //获取数据 String categoryId=request.getParameter("categoryId"); String categoryName=request.getParameter("categoryName"); Category category=new Category(categoryId,categoryName); CategoryService categoryService=new CategoryServiceImpl(); List<Category> categoryList=(List<Category>)request.getSession().getAttribute("categoryList"); if(categoryList==null) { categoryList=new ArrayList(); } //将输入的数据与后台比对 Category existCategory=categoryService.check(category); if(existCategory==null) { //如果后台数据中为空,则添加数据,同时将分类加入到分类列表中 categoryService.addCategory(categoryId, categoryName); categoryList.add(category); //将列表的集合存入session中 request.getSession().setAttribute("categoryList", categoryList); response.sendRedirect(request.getContextPath()+"/categoryList.jsp"); }else { response.sendRedirect(request.getContextPath()+"/addCategory.jsp?flag=1"); } } }
package com.imooc.web.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.imooc.mainclass.Category; import com.imooc.service.CategoryService; import com.imooc.service.impl.CategoryServiceImpl; @WebServlet("/deleteCategoryServlet") public class deleteCategoryServlet extends HttpServlet { private static final long serialVersionUID = 1L; public deleteCategoryServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String categoryId=request.getParameter("categoryId"); CategoryService categoryService=new CategoryServiceImpl(); categoryService.deleteCategory(categoryId); List<Category> categoryList=(List<Category>) request.getSession().getAttribute("categoryList"); Category cate=null; for(Category category:categoryList) { if(category.getCategoryId().equals(categoryId)) { cate=category; } } categoryList.remove(cate); request.getSession().setAttribute("categoryList", categoryList); response.sendRedirect(request.getContextPath()+"/categoryList.jsp"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
package com.imooc.web.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.imooc.mainclass.User; import com.imooc.service.UserService; import com.imooc.service.impl.UserServiceImpl; @WebServlet("/LoginServlet") public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; public LoginServlet() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String code1=(String) request.getSession().getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); String code2=request.getParameter("checkCode"); if(code2==null||!code2.equalsIgnoreCase(code1)) { request.setAttribute("msg", "验证码输入不正确!"); request.getRequestDispatcher("/login.jsp").forward(request, response); return; } //接收数据 String username=request.getParameter("username"); String password=request.getParameter("password"); //封装数据 User user=new User(username,password); //处理数据,完成登录 UserService userService=new UserServiceImpl(); //获取用户列表的集合 List<User> userList=(List<User>)getServletContext().getAttribute("userList"); User existUser=userService.login(userList,user); //显示结果 if(existUser==null) { //登录失败 request.setAttribute("msg", "用户名或者密码错误"); request.getRequestDispatcher("/login.jsp").forward(request, response); }else { //登录成功 request.getSession().setAttribute("existUser",existUser); request.getSession().setAttribute("loginUser", username); response.sendRedirect(request.getContextPath()+"/categoryList.jsp"); } } }
jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <% String loginUser=(String)request.getSession().getAttribute("loginUser"); %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>新建图书信息</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/add.css"> </head> <body> <nav class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="/dept/list.do"> 图书信息管理 </a> </div> </div> </nav> <div class="container"> <div class="jumbotron"> <h1>Hello, <%=loginUser%>!</h1> <p>请小心地新增图书信息,要是建了一个错误的就不好了。。。</p> </div> <div class="page-header"> <h3><small>新建</small></h3> </div> <form class="form-horizontal" action="${pageContext.request.contextPath}/addBookServlet" method="post" enctype="multipart/form-data"> <div class="form-group"> <label for="name" class="col-sm-2 control-label">图书编号 :</label> <div class="col-sm-8"> <input name="bookId" class="form-control" id="bookId"> </div> </div> <div class="form-group"> <label for="name" class="col-sm-2 control-label">图书名称 :</label> <div class="col-sm-8"> <input name="bookName" class="form-control" id="bookName"> </div> </div> <div class="form-group"> <label for="categoryId" class="col-sm-2 control-label">分类 :</label> <select id="categoryId" name="categoryId" class="col-sm-2 form-control" style="width: auto;margin-left: 15px"> <c:forEach items="${sessionScope.categoryList}" var="cList" varStatus="idx"> <option value="${cList.categoryId}" selected="">${cList.categoryName}</option> </c:forEach> <!-- 下拉列表的内容要从分类中进行读取,value值是分类id --> </select> </div> <div class="form-group"> <label for="name" class="col-sm-2 control-label">价格 :</label> <div class="col-sm-8"> <input name="bookPrice" class="form-control" id="bookPrice"> </div> </div> <div class="form-group" > <label for="name" class="col-sm-2 control-label">图书封面 :</label> <input type="file" id="bookPic" name="bookPic" style="padding-left: 15px"> </div> <div class="form-group"> <label for="name" class="col-sm-2 control-label">备注 :</label> <div class="col-sm-8"> <input name="remarks" class="form-control" id="remarks"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">保存</button> </div> </div> </form> </div> <footer class="text-center" > copy@imooc </footer> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String loginUser=(String)request.getSession().getAttribute("loginUser"); String flag=(String)request.getParameter("flag"); %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>新建图书分类</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/add.css"> <script type="text/javascript"> var flag='<%=flag%>'; if(flag=="1"){ alert("您输入的分类已存在,请重新输入"); } </script> </head> <body> <nav class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href=""> 图书分类管理 </a> </div> </div> </nav> <div class="container"> <div class="jumbotron"> <h1>Hello, <%=loginUser%>!</h1> <p>请小心地新增图书分类,要是建了一个错误的就不好了。。。</p> </div> <div class="page-header"> <h3><small>新建</small></h3> </div> <form class="form-horizontal" action="${pageContext.request.contextPath}/addCategoryServlet" method="post"> <div class="form-group"> <label for="name" class="col-sm-2 control-label">分类ID :</label> <div class="col-sm-8"> <input name="categoryId" class="form-control" id="categoryId"> </div> </div> <div class="form-group"> <label for="name" class="col-sm-2 control-label">分类名称 :</label> <div class="col-sm-8"> <input name="categoryName" class="form-control" id="categoryName"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">保存</button> </div> </div> </form> </div> <footer class="text-center" > copy@imooc </footer> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>图书后台管理</title> <link rel="stylesheet" href="css/index.css"> <link rel="stylesheet" href="css/bootstrap.min.css"> </head> <body> <header> <div class="container"> <nav> <a href="${pageContext.request.contextPath}/bookList.jsp" >图书信息管理</a> </nav> <nav> <a href="${pageContext.request.contextPath}/categoryList.jsp" >分类管理</a> </nav> </div> </header> <section class="banner"> <div class="container"> <div> <h1>图书管理系统</h1> <p>图书信息管理</p> </div> </div> </section> <section class="main"> <div class="container"> <form class="form-horizontal" action="/searchBook" method="post"> <div class="form-group" style="float: right;"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">查询</button> </div> </div> <div class="form-group" style="float: right;width: 300px;"> <div class="col-sm-8"> <input name="searchContent" class="form-control" id="searchContent" placeholder="输入要查询的分类" style="width: 250px"> </div> </div> </form> </div> <div class="container"> <table class="table table-striped"> <thead> <tr> <th>序号</th> <th>图书编号</th> <th>图书名称</th> <th>分类</th> <th>价格</th> <th>图书封面</th> <th>操作</th> </tr> </thead> <tbody> <c:forEach items="" var=""> <tr id="tr1"> <td>1</td> <td>book0001</td> <td>Java基础</td> <td>计算机类</td> <td>¥29</td> <td><img src="img/g1.jpg"></td> <td> <a href="/updateBook?bookId=book0001">修改</a> <a href="/deleteBook?bookId=book0001">删除</a> </td> <!--在循环显示数据时,此处的book0001可以用EL表达式进行替换--> </tr> </c:forEach> </tbody> </table> </div> </section> <section class="page"> <div class="container"> <div id="fatie"> <a href="${pageContext.request.contextPath}/addBook.jsp"><button>新建</button></a> </div> </div> </section> <footer> copy@慕课网 </footer> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>图书后台管理</title> <link rel="stylesheet" href="css/index.css"> <link rel="stylesheet" href="css/bootstrap.min.css"> </head> <body> <header> <div class="container"> <nav> <a href="${pageContext.request.contextPath}/bookList.jsp" >图书信息管理</a> </nav> <nav> <a href="${pageContext.request.contextPath}/categoryList.jsp" >分类管理</a> </nav> </div> </header> <section class="banner"> <div class="container"> <div> <h1>图书管理系统</h1> <p>图书分类管理</p> </div> </div> </section> <section class="main"> <div class="container"> <table class="table table-striped"> <thead> <tr> <th>序号</th> <th>分类编号</th> <th>分类名称</th> <th>操作</th> </tr> </thead> <tbody> <c:forEach items="${sessionScope.categoryList}" var="cList" varStatus="idx"> <c:if test="${sessionScope.categoryList!=null}"> <tr> <td>${idx.index+1}</td> <td>${cList.categoryId}</td> <td>${cList.categoryName}</td> <td><a href="${pageContext.request.contextPath}/deleteCategoryServlet?categoryId=${cList.categoryId}">删除</a></td> <!--在循环显示数据时,此处的ca0001可以用EL表达式进行替换--> </tr> </c:if> </c:forEach> </tbody> </table> </div> </section> <section class="page"> <div class="container"> <div id="fatie"> <a href="${pageContext.request.contextPath}/addCategory.jsp"><button>新建</button></a> </div> </div> </section> <footer> copy@慕课网 </footer> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String flag=request.getParameter("flag"); %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>登录</title> <link rel="stylesheet" href="css/login.css"> <script type="text/javascript"> function changeImg(){ var codeImg=document.getElementById("codeImg"); codeImg.src="${pageContext.request.contextPath}/KaptchaServlet?time="+new Date().getTime(); } var flag='<%=flag%>'; if(flag=="1"){ alert("请登录系统"); } </script> </head> <body> <div class="login"> <div class="header"> <h1> <a href="/login.do">登录</a> </h1> <button></button> </div> <form action="${pageContext.request.contextPath}/LoginServlet" method="post"> <div class="name"> <input type="text" id="name" name="username" placeholder="用户名"> <p>${msg}</p> </div> <div class="pwd"> <input type="password" id="pwd" name="password" placeholder="密码"> <p></p> </div> <div class="code"> <input type="text" id="code" name="checkCode" placeholder="验证码" style="width: 150px"> <img id="codeImg" onclick="changeImg()" src="${pageContext.request.contextPath}/KaptchaServlet" style="width: 150px;height: 42px;vertical-align: middle;"> <p></p> </div> <div class="btn-red"> <input type="submit" value="登录" id="login-btn"> </div> </form> </div> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>修改图书信息</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/add.css"> </head> <body> <nav class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="/dept/list.do"> 图书信息管理 </a> </div> </div> </nav> <div class="container"> <div class="jumbotron"> <h1>Hello, XXX!</h1> <p>请小心的修改图书信息。。。</p> </div> <div class="page-header"> <h3><small>修改</small></h3> </div> <form class="form-horizontal" action="/dept/add.do" method="post"> <div class="form-group"> <label for="name" class="col-sm-2 control-label">图书编号 :</label> <div class="col-sm-8"> <input name="bookId" class="form-control" id="bookId" readonly="readonly"> </div> </div> <div class="form-group"> <label for="name" class="col-sm-2 control-label">图书名称 :</label> <div class="col-sm-8"> <input name="bookName" class="form-control" id="bookName"> </div> </div> <div class="form-group"> <label for="categoryId" class="col-sm-2 control-label">分类 :</label> <select id="categoryId" name="categoryId" class="col-sm-2 form-control" style="width: auto;margin-left: 15px"> <option value="ca0001" selected="">计算机</option> <option value="ca0002">文学</option> <option value="ca0003">历史</option> <!-- 下拉列表的内容要从分类中进行读取,value值是分类id --> </select> </div> <div class="form-group"> <label for="name" class="col-sm-2 control-label">价格 :</label> <div class="col-sm-8"> <input name="bookPrice" class="form-control" id="bookPrice"> </div> </div> <div class="form-group" > <label for="name" class="col-sm-2 control-label">图书封面 :</label> <input type="file" id="bookPic" name="bookPic" style="padding-left: 15px"> </div> <div class="form-group"> <label for="name" class="col-sm-2 control-label">备注 :</label> <div class="col-sm-8"> <input name="remarks" class="form-control" id="remarks"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">修改</button> </div> </div> </form> </div> <footer class="text-center" > copy@imooc </footer> </body> </html>
xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>test6_2</display-name> <servlet> <servlet-name>KaptchaServlet</servlet-name> <servlet-class>com.google.code.kaptcha.servlet.KaptchaServlet</servlet-class> <init-param> <param-name>kaptcha.textproducer.char.length</param-name> <param-value>4</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>KaptchaServlet</servlet-name> <url-pattern>/KaptchaServlet</url-pattern> </servlet-mapping> <filter> <filter-name>EncodeFilter</filter-name> <filter-class>com.imooc.filter.EncodeFilter</filter-class> <init-param> <param-name>charset</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>EncodeFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>AuthFilter</filter-name> <filter-class>com.imooc.filter.AuthFilter</filter-class> </filter> <filter-mapping> <filter-name>AuthFilter</filter-name> <url-pattern>/categoryList.jsp</url-pattern> </filter-mapping> </web-app>
jar包和js
6
收起
正在回答 回答被采纳积分+1
4回答
2. 从网页搭建入门JavaWeb
- 参与学习 人
- 提交作业 676 份
- 解答问题 9666 个
本阶段将从前端网页搭建入手,到Java Web基础,前后端结合助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星