ssh设计一个课程评分页面,才开始做学生登陆运行,运行就不成功,数据库用的是oracle11g,没办法接着做下面的内容了
测试能到login。jsp,但点提交就不行了
文件结构
jar包
数据库:
create table Student
(
Sno number(10) primary key,
Sname varchar2(20) not null,
Spassword varchar2(10) not null,
Cno varchar2(20),
Cname varchar2(20)
)tablespace TEST1;
insert into student values(13103226,'gongxue','13103226','1234','orcl');
#代码如下
映射文件:
配置文件applicationcontext.xml:
DAO:
接口:public interface StudentDAO {
List findAll();//查找全部学生
}
实现:
Service:
接口:
import java.util.List;
import com.oracle.entity.Student;
public interface StudentService {
List findAll();//查找全部学生
}
实现
Action:
package com.oracle.action;
import java.util.Iterator;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
import com.oracle.entity.Student;
import com.oracle.service.StudentService;
@SuppressWarnings("serial")
public class StudentLoginAction extends ActionSupport {
String name;// 账号
String password;// 密码
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
// 设置业务逻辑组件
private StudentService studentService;
public void setStudentService(StudentService studentService) {
this.studentService = studentService;
}
// 登陆检查
public String execute() {
List<Student> list = (List<Student>) studentService.findAll();
Student u = new Student();
Iterator<Student> it = list.iterator();
while (it.hasNext()) {
u = (Student) it.next();
if (name.trim().equals(u.getSname()) && password.trim().equals(u.getSpassword()))
return "success";
else
return "failer";
}
String page = "failer";
return page;
}
}
Struts。xml:
web.xml;
jsp页面:
login:
这是主要的内容了,急求解决,要不然就做不了后面的内容了
谢谢,谢谢