mysql-学渣妹纸·······servlet,jsp跳转问题
mysql跳转servletjsp
呜呜,学生管理系统。用jsp,servlet,eclipse,mysql编成。貌似是servlet,jsp跳转出现了问题
.求大神帮帮忙。加qq896151657。下面是部分代码
UserLogin.java
package com.servlet;
import com.dao.*;
import com.db.*;
import com.vo.*;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class UserLogin extends HttpServlet {
public UserLogin() {
super();
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
response.setCharacterEncoding("gbk");
request.setCharacterEncoding("gbk");
HttpSession session=request.getSession();
//PrintWriter out=response.getWriter();
<code> String UserName=request.getParameter("UserName");</code>
String UserPassword=request.getParameter("UserPassword");
User u=null;
UserDao us=null;
if(UserName.equals("")||UserPassword.equals("")){
session.setAttribute("userloginstr","请填写完整");
request.getRequestDispatcher("/UserLoginfail.jsp").forward(request,response);
}else{
u=new User();
us=new UserDao();
u.setUserName(UserName);
u.setUserPassword(UserPassword);
User u1=us.selectInformation(u);
//System.out.println(userName);
//System.out.println(u1.getUserName());
if(UserName.equals(u1.getUserName())&&UserPassword.equals(u1.getUserPassword()))
{
session.setAttribute("userloginname",UserName);
request.getRequestDispatcher("/User.jsp").forward(request,response);
}else{
if(!UserName.equals(u1.getUserName())){
session.setAttribute("userloginstr","没有此管理员");
request.getRequestDispatcher("/UserLoginfail.jsp").forward(request,response);
}else{
session.setAttribute("userloginstr","密码或管理员名不正确");
request.getRequestDispatcher("/UserLoginfail.jsp").forward(request,response);
}
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
public void init() throws ServletException {
}
}
UserLogin.jsp
UserLogin page
管理员登陆界面
管理员: | (不识别中文,请输入英文) | |
密 码: | ||
注册新管理员 |
退出管理员界面

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)
