没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
















JavaWeb实现简单查询商品功能实现简单查询商品功能
主要为大家详细介绍了JavaWeb实现简单查询商品功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一
下
本文实例为大家分享了JavaWeb实现简单查询商品功能的具体代码,供大家参考,具体内容如下
CustomerServlet.java
package com.subing.web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/CustomerServlet")
public class CustomerServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private SqlDemo sql = null;
private final static String s1 = "<h1>欢迎进入管理页面</h1><form action='CustomerServlet' method='post'> "
+ "精确查询:<input type='text' name='jqmess'/><br>"
+ "模糊查询:<input type='text' name='mhmess'/><br>"
+ "<input type='submit' value='提交' name='sub'/>"
+ "</form>";
// 登录的时候进行验证
private boolean isLoginProv(String userinfo, String password) {
if (userinfo != null && userinfo.length() > 0 && password != null
&& password.length() > 0) {
return true;
}
return false;
}
public CustomerServlet() throws Exception {
super();
sql = new SqlDemo(); // 进行数据库访问的类
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
this.doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=gb2312");
request.setCharacterEncoding("gb2312");
PrintWriter pw = response.getWriter();
String sub = request.getParameter("sub");
String login = request.getParameter("login");
if (login != null && login.length() > 0) {
String admin_id = request.getParameter("admin_id");
String password = request.getParameter("password");
if (isLoginProv(admin_id, password)) {
try {
if (sql.loginVerify(admin_id, password)) {
资源评论


weixin_38598213
- 粉丝: 2
- 资源: 854
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制
