⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logaction.java

📁 用struts+hibernate+spring做的登录
💻 JAVA
字号:
package struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import form.UserForm;

import java.util.List;

public class LogAction extends BaseAction 
{

public ActionForward execute(ActionMapping mapping,
							ActionForm form,
								HttpServletRequest request,
								HttpServletResponse response)
{
	
	UserForm userForm = (UserForm) form;
	String username = userForm.getUsername();
	String password = userForm.getPsw();
	
   if(!this.getUserinfoService().exist(username, password))//判断该用户是否存在
	{	
//	 request.setAttribute("pswerror", "用户名不存在或密码错误!");
		return mapping.findForward("fail");
	   
	}
   else
   {
	  List list=this.getUserinfoService().getInfo();
		
		request.setAttribute("fa",list);
		
		
		
	   return mapping.findForward("suc");
	}
   
 }

}
//Query Q = session.createQuery("from customer as c where c.name = :customerName" + "and c.age = :customerAge");
//
//query.setString ("customerName" , "tom");
//
//query.setInteger("customerAge" , "21");
//
//list result = query.list();


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -