帮我看下在netbean中的这个servlet代码有什么错误,系统一直提示不可用
packageservlet;importjava.io.IOException;importjava.io.PrintWriter;importdb.DB;import...
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import db.DB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RegaisterServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("gb2312");
response.setContentType("gb2312");
PrintWriter out = response.getWriter();
String username=request.getParameter("username");
String pwd=request.getParameter("pwd");
if(new DB().insertUser(username,pwd)){
response.sendRedirect("login.jsp");
}
}
} 展开
import java.io.IOException;
import java.io.PrintWriter;
import db.DB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RegaisterServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("gb2312");
response.setContentType("gb2312");
PrintWriter out = response.getWriter();
String username=request.getParameter("username");
String pwd=request.getParameter("pwd");
if(new DB().insertUser(username,pwd)){
response.sendRedirect("login.jsp");
}
}
} 展开
展开全部
楼上说的对啊,你这servlet 是自己写的吗?怎么没有dopost() getpost()这俩个方法 呢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
错误提示信息都没有,你这样看上去像是对的。详细点吧
追问
你能帮我看一下代码吗?加Q759983864
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dopost和doget呢
追问
有这个 processRequest 啦……
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询