请教各位大哥转向传值的问题
package myweb2;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class userServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK ";
//Initialize global variables
public void init() throws
ServletException {
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String UserName,UserPass;
UserName=request.getParameter( "UserName ");
UserPass=request.getParameter( "UserPass ");
userBean info = new userBean();
info.setUsername(UserName);
info.setUserpass(UserPass);
user2 s = new user2();
s.inserUserInfo(info);
request.setAttribute( "username ",UserName);
request.setAttribute( "userpass ",UserPass);
//request.getRequestDispatcher( "index.jsp ").forward(request,response);
RequestDispatcher requestDispatcher=request.getRequestDispatcher( "index.jsp ");
requestDispatcher.forward(request,response);
}
//Clean up resources
public void destroy() {
}
}
---------------------------
<%@ page contentType= "text/html; charset=GBK " %>
<html>
<head>
<meta h