📄 modifypassword.java
字号:
package mypackage;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.naming.NamingException;
public class ModifyPassword extends HttpServlet
{
private static final String CONTENT_TYPE = "text/html; charset=GBK";
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String accounts = (String)request.getSession().getAttribute("accounts");
String password = request.getParameter("password");
int success = 0;
try{
Context context = new InitialContext();
TaskHome taskHome = (TaskHome)PortableRemoteObject.narrow(context.lookup("Task"), TaskHome.class);
Task task;
task = taskHome.create();
success = task.modifyPassword(accounts, password);
}
catch(Throwable ex){
ex.printStackTrace();
}
if(success == 1){
request.getSession().getServletContext().getRequestDispatcher("/modifysuccess.jsp").forward(request, response);
request.getSession().removeAttribute("chn");
request.getSession().removeAttribute("accounts");
}
else
request.getSession().getServletContext().getRequestDispatcher("/modifyfail.jsp").forward(request, response);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -