——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明





基于javaweb的JSP+Servlet大学生家教管理系统(java+jsp+struts+mysql)
前台首页:http://localhost:8080
学生用户帐号:xiaoqiang 密码:123456
教师用户帐号:xiaoniu 密码:123456
后台管理员:http://localhost:8080/admin/login.jsp
管理员名:admin
密码:123456
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
public class MemberAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { request.setCharacterEncoding("gb2312"); } catch (Exception ex) { ex.printStackTrace(); } String strr=""; try{ HttpSession session = request.getSession(); MemberBean memberBean = new MemberBean(); String method = Filter.escapeHTMLTags(request.getParameter("method").trim());
if(method.equals("reg2")){ String username = Filter.escapeHTMLTags(request.getParameter("username").trim()); String password = Filter.escapeHTMLTags(request.getParameter("password").trim()); String reg_type = Filter.escapeHTMLTags(request.getParameter("reg_type").trim()); request.setAttribute("username", username); request.setAttribute("password", password); request.setAttribute("reg_type", reg_type); if(username.trim().equals("admin")){ request.setAttribute("username", username); request.setAttribute("message", "非法的用户名,请重新选择!"); request.getRequestDispatcher("reg2.jsp").forward(request, response); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| } java.io.File file = new java.io.File(s); FileInputStream fileinputstream = new FileInputStream(file); long l = file.length(); int k = 0; byte abyte0[] = new byte[i]; if(s1 == null) { m_response.setContentType("application/x-msdownload"); } else { if(s1.length() == 0) { m_response.setContentType("application/x-msdownload"); } else { m_response.setContentType(s1); } } m_response.setContentLength((int)l); m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;"; if(s2 == null) { m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s)); } else { if(s2.length() == 0) { m_response.setHeader("Content-Disposition",m_contentDisposition); } else { m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + s2); } } while((long)k < l) { int j = fileinputstream.read(abyte0,0,i); k += j; m_response.getOutputStream().write(abyte0,0,j); } fileinputstream.close(); }
public void downloadField(ResultSet resultset,String s,String s1,String s2) throws ServletException,IOException,SQLException { if(resultset == null) {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| public byte getBinaryData(int i) { byte byte0; try { byte0 = m_binArray[i]; } catch(Exception exception) { throw new ArrayIndexOutOfBoundsException("Index out of range (1005)."); } return byte0; }
public SmartFiles getFiles() { return m_files; }
public SmartRequest getRequest() { return m_formRequest; }
public void downloadFile(String s) throws ServletException,IOException,SmartUploadException { downloadFile(s,null,null); }
public void downloadFile(String s,String s1) throws ServletException,IOException,SmartUploadException,SmartUploadException { downloadFile(s,s1,null); }
public void downloadFile(String s,String s1,String s2) throws ServletException,IOException,SmartUploadException { downloadFile(s,s1,s2,65000); }
public void downloadFile(String s,String s1,String s2,int i) throws ServletException,IOException,SmartUploadException { if(s == null) { throw new IllegalArgumentException("File '" + s + "' not found (1040)."); } if(s.equals("")) { throw new IllegalArgumentException("File '" + s + "' not found (1040)."); } if(!isVirtual(s) && m_denyPhysicalPath) { throw new SecurityException("Physical path is denied (1035).");
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| file.setContentType(s7); file.setContentDisp(s8); file.setTypeMIME(s9); file.setSubTypeMIME(s10); if(s7.indexOf("application/x-macbinary") > 0) { m_startData = m_startData + 128; } file.setSize((m_endData - m_startData) + 1); file.setStartData(m_startData); file.setEndData(m_endData); m_files.addFile(file); } else { String s11 = new String(m_binArray,m_startData,(m_endData - m_startData) + 1); m_formRequest.putParameter(s3,s11); } if((char)m_binArray[m_currentIndex + 1] == '-') { break; } } }
public int save(String s) throws ServletException,IOException,SmartUploadException { return save(s,0); }
public int save(String s,int i) throws ServletException,IOException,SmartUploadException { int j = 0; if(s == null) { s = m_application.getRealPath("/"); } if(s.indexOf("/") != -1) { if(s.charAt(s.length() - 1) != '/') { s = s + "/";
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| { throw new SecurityException("Size exceeded for this file : " + s4 + " (1105)."); } l += (m_endData - m_startData) + 1; if(m_totalMaxFileSize > 0L && l > m_totalMaxFileSize) { throw new SecurityException("Total File Size exceeded (1110)."); } } if(flag3) { SmartFile file = new SmartFile(); file.setParent(this); file.setFieldName(s3); file.setFileName(s4); file.setFileExt(s5); file.setFilePathName(s6); file.setIsMissing(s6.length() == 0); file.setContentType(s7); file.setContentDisp(s8); file.setTypeMIME(s9); file.setSubTypeMIME(s10); if(s7.indexOf("application/x-macbinary") > 0) { m_startData = m_startData + 128; } file.setSize((m_endData - m_startData) + 1); file.setStartData(m_startData); file.setEndData(m_endData); m_files.addFile(file); } else { String s11 = new String(m_binArray,m_startData,(m_endData - m_startData) + 1); m_formRequest.putParameter(s3,s11); } if((char)m_binArray[m_currentIndex + 1] == '-') { break; } } }
public int save(String s) throws ServletException,IOException,SmartUploadException { return save(s,0); }
public int save(String s,int i) throws ServletException,IOException,SmartUploadException { int j = 0; if(s == null) {
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=292123190309201dv
https://javayms.pages.dev?id=292123190309201dv