81,091
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>IPDASSSS</title>
<link rel="stylesheet" type="text/css" href="themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="themes/icon.css">
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
<script>
function dosubmit() {
document.loginForm.enctype="multipart/form-data";
document.loginForm.submit();
}
</script>
</head>
<body>
<form id="loginform" name="loginForm" action="loginAction" method="post">
<div id="loginin" class="easyui-window" closable="false" draggable="false" resizable="false" title="欢迎登陆" style="width:300px;height:120px;">
登陆ID:<input name="student.id"/><br>
登陆密码:<input name="student.password"/><br>
<a class="easyui-linkbutton" iconCls="icon-ok" onclick="dosubmit()">登陆</a>
</div>
</form>
</body>
</html>
package com.tfsp.action;
import java.util.List;
import java.util.Map;
import org.apache.struts2.interceptor.RequestAware;
import com.opensymphony.xwork2.ActionSupport;
import com.tfsp.model.Student;
import com.tfsp.service.StudentService;
public class LoginAction extends ActionSupport implements RequestAware{
private StudentService studentService;
private Student student;
//对应HttpRequest作用域,由RequestAware注入
private Map request;
public String login(){
boolean b = studentService.login(student);
if(b){
List<Student> studentList = studentService.getAllStudent();
request.put("studentList", studentList);
return SUCCESS;
}else{
return "error";
}
}
public StudentService getStudentService() {
return studentService;
}
public void setStudentService(StudentService studentService) {
this.studentService = studentService;
}
/**
* @return the student
*/
public Student getStudent() {
return student;
}
/**
* @param student the student to set
*/
public void setStudent(Student student) {
this.student = student;
}
public Map getRequest() {
return request;
}
public void setRequest(Map request) {
this.request = request;
}
}