急!使用window.location.href提交到servlet后,如何使用转发到页面或重定向?
js:window.location.href='<%=request.getContextPath()%>/login?phone='+phone+'&pwd='+pw...
js :
window.location.href='<%=request.getContextPath()%>/login?phone='+phone+'&pwd='+pwd;
servlet :
String phone = request.getParameter(“phone”);
String pwd = request.getParameter(“pwd”);
fr = new FileReader("C:\\dk.txt");
BufferedReader br = new BufferedReader(fr);
String line = br.readLine();
if(line ==null){
System.out.println("第一次");
File f=new File("C:\\dk.txt");
try {
FileWriter txt=new FileWriter(f);
txt.write(ThreeRdSecuritUtils.encryptParamterDES(pwd));
txt.close();
request.getRequestDispatcher("mainIndex.jsp").forward(request, response);
} catch (IOException e) {
e.printStackTrace();
}
无法转发到mainIndex.jsp页面求解!!! 展开
window.location.href='<%=request.getContextPath()%>/login?phone='+phone+'&pwd='+pwd;
servlet :
String phone = request.getParameter(“phone”);
String pwd = request.getParameter(“pwd”);
fr = new FileReader("C:\\dk.txt");
BufferedReader br = new BufferedReader(fr);
String line = br.readLine();
if(line ==null){
System.out.println("第一次");
File f=new File("C:\\dk.txt");
try {
FileWriter txt=new FileWriter(f);
txt.write(ThreeRdSecuritUtils.encryptParamterDES(pwd));
txt.close();
request.getRequestDispatcher("mainIndex.jsp").forward(request, response);
} catch (IOException e) {
e.printStackTrace();
}
无法转发到mainIndex.jsp页面求解!!! 展开
若以下回答无法解决问题,邀请你更新回答
2015-10-14
展开全部
是相当于GET的方式吧 。。。。。。。。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询