这个一百分的问题谁能拿? InputStream in=application.getResourceAsStream("/WEB-INF/users.properties");目录不对吧,把users.properties放到%approot%/WEB-INF/classes/下然后InputStream in=application.getResourceAsStream(/users.properties"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你在前面写了一大堆html再运行sendRedirect肯定有问题 应该是读文件有错吧,你把读出来的内容out出来看看 没一个对的,我的程序在jbuider9下运行,users.properties也放在项目中的WEB-INF目录底下,望大家运行调试好再回贴好吗?我将在一周后结帖,如无正确答案,我只好把这一百分收回了,不好意思. 解狐不会这麽敏感吧,问题我已解决,只需用trim()就行了,百分我收回了,再次感谢大家的关注 你先看看在<%if(request.getMethod().equalsIgnoreCase("POST")){String username=request.getParameter("username"); String password=request.getParameter("password");if(userIsValid(request,application,username,password)) {response.sendRedirect("post.jsp"); return;}else {%> <h2>未通过验证</h2> <%}代码中取得用户名和密码之后能不能显示估计没有什么问题如果能则问题就出在<%!public boolean userIsValid(HttpServletRequest request, ServletContext application, String username, String password)throws java.io.IOException{Properties users=new Properties();InputStream in=application.getResourceAsStream("/WEB-INF/users.properties");try{ users.load(in); String fullname=users.getProperty("username"); System.out.println(fullname); System.out.println(users.getProperty(username+".+password")); if(fullname!=null&&password.equals(users.getProperty(username+".+password"))) {request.getSession(true).setAttribute("fullname",fullname); return true;} else{return false;} }finally{in.close();}}%>这个函数里边 急! poi怎么合并excel问题! mysql怎么查一条数据 extjs editorGridPanel 数据验证 运行一个jsp是出错,求大侠们帮帮忙 zk中我嵌入flash,zk组件事件响应会很慢 请问配置文件??? 在表单中取得字符型的怎么转换成boolean类型的?解决马上给分 为了改weblogic的jsp默认路径,我再送100分。 请大家提供几个下载Jsp源程序的网址,谢谢! 求助啊!!web.xml里面报错 tomcat起不来 如何去掉 8080 呀,如:http://localhost:8080/aa.jsp 请问上传文件的问题
<%if(request.getMethod().equalsIgnoreCase("POST"))
{String username=request.getParameter("username");
String password=request.getParameter("password");
if(userIsValid(request,application,username,password))
{response.sendRedirect("post.jsp");
return;}
else
{%>
<h2>未通过验证</h2>
<%}
代码中取得用户名和密码之后能不能显示
估计没有什么问题
如果能则问题就出在
<%!public boolean userIsValid(HttpServletRequest request,
ServletContext application,
String username,
String password)
throws java.io.IOException
{Properties users=new Properties();
InputStream in=application.getResourceAsStream("/WEB-INF/users.properties");
try{
users.load(in);
String fullname=users.getProperty("username");
System.out.println(fullname);
System.out.println(users.getProperty(username+".+password"));
if(fullname!=null&&password.equals(users.getProperty(username+".+password")))
{request.getSession(true).setAttribute("fullname",fullname);
return true;}
else{return false;}
}
finally{in.close();}
}
%>
这个函数里边