让软件闪退的java代码 让软件闪退的java代码
java用户名与密码5次输入错误后自动退出代码
public String login() throws Exception {
成都创新互联公司网站建设服务商,为中小企业提供做网站、网站设计服务,网站设计,网站改版维护等一站式综合服务型公司,专业打造企业形象网站,让您在众多竞争对手中脱颖而出成都创新互联公司。
String rand = (String) session.get("rand");
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("GBK");
PrintWriter out = response.getWriter();
if (rand.equals(inputrand)) {
if (userDao.login(user)) {
User u = userDao.getSingleUser(user.getUsername());
int ismanager = u.getIsmanager();
session.put("ismanager", ismanager);
String leftBar = menuDao.getLoginMenu(user.getUsername(),
ismanager);
session.put("allmenu", menuDao.getAllMenu());
session.put("loginname", user.getUsername());
session.put("loginpwd", user.getPassword());
session.put("leftbar", leftBar);
session.put("tip", tipDao.getUserTips(user.getUsername()));
return SUCCESS;
} else {
Integer count = (Integer) session.get("loginCount");
String str = "";
if (count != null) {
count++;
if (count = 2) {
String message = "登陆失败三次,关闭窗口";
str = "scriptalert('"
+ message
+ "');"
+ "window.open('','_top');window.opener=null;window.close();/script";
} else {
session.put("loginCount", count);
String message = "用户名或密码错误,请重新输入";
String link = "/login.jsp";
str = "scriptalert('" + message + "');"
+ "window.location.href='"
+ request.getContextPath() + "" + link
+ "'/script";
}
} else {
session.put("loginCount", 1);
String message = "用户名或密码错误,请重新输入";
String link = "/login.jsp";
str = "scriptalert('" + message + "');"
+ "window.location.href='"
+ request.getContextPath() + "" + link
+ "'/script";
}
out.println(str);
out.flush();
out.close();
return null;
}
} else {
String message = "验证码出错,请重新输入";
String link = "/login.jsp";
String str = "scriptalert('" + message + "');"
+ "window.location.href='" + request.getContextPath() + ""
+ link + "'/script";
out.println(str);
out.flush();
out.close();
return null;
}
}
android程序闪退,报错为unable to resume activity
equals换下位置就好了,"camera".equals(intent.getStringExtra("action"))
因为intent.getStringExtra("action")可能为null了,所以报空指针了。
java try catch中如何抛出异常 让程序停止运行??
真要停止的话用System.exit(1)更合适。
一般还是throw RuntimeException更合适一点,调用方可以决定要不要停止
求一个能强制关闭某程序的编程代码,只要这个程序运行就能立刻关闭的,最好是阻止java运行
On Error Resume Next
sub Close_Process(ProcessName)
On Error Resume Next
for each ps in getobject("winmgmts:\\.\root\cimv2:win32_process").instances_ '循环进程
if Ucase(ps.name)=Ucase(ProcessName) then
ps.terminate
end if
next
end sub
Close_Process("javaw.exe")
将内容复制到文本文件中,重命名为.vbs文件,运行后就OK了,慎用!!
新闻标题:让软件闪退的java代码 让软件闪退的java代码
本文链接:http://ybzwz.com/article/dodgihh.html