跳到servlet显示空白页的问题 请各位高手指点 谢谢
好心人再帮我看下 为什么我下面的代码有问题呀,超链接到servlet后显示空白页面?
<A href="<%=request.getContextPath()%>/AuloadingServlet">管理员入口</A>
AuloadingServlet的代码如下,很简单的 看下 谢谢
package com.wl.control;
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.Cookie;
public class AuloadingServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws
ServletException,
IOException {
response.setContentType("text/html");
Cookie []allCookie=request.getCookies();
int i=0;
String val=null;
if(allCookie!=null){
for(i=0;i<allCookie.length;i++){
Cookie temp=allCookie[i];
if(temp.getName().equals("admin")){
val=temp.getValue();
request.getRequestDispatcher("gly.jsp?user="+val).forward(request, response);
}
}
}
else if(allCookie==null){
request.getRequestDispatcher("1.jsp").forward(request, response);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
从超链接跳到servlet后,出现空白页面,后台现在也不输出错误 郁闷 请高手指教
------解决方案--------------------
很明显的啊,你的else呢?if和if else不能全部包含的!在加一个else就好了