大神帮忙看看这个JavaEE项目为什么不能成功运行啊

baidu_29042955 2015-06-15 11:09:36
Action类:
package action;

import service.biz;
import service.Impl.bizImpl;

import com.opensymphony.xwork2.ActionSupport;

import entity.ygtwo;
import entity.yuangong;
public class TeacherAction extends ActionSupport {
public yuangong yuan;//实例化员工正常签到
public ygtwo yg;//实例化非正常签到
private biz s;

// 跳转到签到页面
public String register(){
return SUCCESS;
}
// 跳转到代理签到页面
public String registertwo(){
return "two";
}
//员工签到或签退
public String write(){


s.register(yuan);
System.out.println("签到成功,继续签到");
return "yes";
}
// 非正常签到
public String rewrite(){
s.unnormal(yg);
System.out.println("哈哈,成功,继续签到");
return "rewrite";
}

public yuangong getYuan() {
return yuan;
}
public void setYuan(yuangong yuan) {
this.yuan = yuan;
}
public ygtwo getYg() {
return yg;
}
public void setYg(ygtwo yg) {
this.yg = yg;
}
public biz getS() {
return s;
}
public void setS(biz s) {
this.s = s;
}
}
Dao:
package Dao;

import entity.ygtwo;
import entity.yuangong;

/*
* 业务方法
*/
public interface dao {
/*
* 保存正常操作
*/
public void Sava(yuangong yuan);

/*
* 保存非正常操作
*/
public void Savenunormal(ygtwo yg);

}
DaoImpl:
package Dao.Impl;


import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import entity.ygtwo;
import entity.yuangong;
import Dao.dao;

public class daoImpl extends HibernateDaoSupport implements dao{

@Override
public void Sava(yuangong yuan) {
System.out.println("程序走到此处222");
// TODO Auto-generated method stub
this.getHibernateTemplate().save(yuan);

}


@Override
public void Savenunormal(ygtwo yg) {
this.getHibernateTemplate().save(yg);


}
}
service:
package service;

import entity.ygtwo;
import entity.yuangong;

//把签到信息注册到数据库
public interface biz {
//正常签到或是签退信息写入
public void register(yuangong yuan);
/*
* 非正常签到或签退
*/
public void unnormal(ygtwo yg);

}
package service.Impl;

import service.biz;
import Dao.dao;
import Dao.Impl.daoImpl;
import entity.ygtwo;
import entity.yuangong;

public class bizImpl implements biz {
private dao d;
public void register(yuangong yuan) {
System.out.println("程序走到此处111");
d.Sava(yuan);

}
@Override
public void unnormal(ygtwo yg) {
d.Savenunormal(yg);

}
public dao getD() {
return d;
}
public void setD(dao d) {
this.d = d;
}
}
实体类:
package entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.xml.crypto.Data;

/*
* 员工实体类,正常签到和签退使用此表
*/

@Entity
@Table(name="yuangong")
public class yuangong {
@Id
@GeneratedValue(generator="y-id",strategy=GenerationType.SEQUENCE)
@SequenceGenerator(name="y-id",initialValue=1,allocationSize=1,sequenceName="yid")
private Integer yid;
@Column(length=10)
private String yname;//姓名
@Column(length=20)
private String ynum;//工号
@Enumerated(EnumType.STRING)
private Type2 ttype;//签到或是签退
public yuangong(){}
public yuangong(String yname,String ynum,Type2 ttype){
this.ttype=ttype;
this.yname=yname;
this.ynum=ynum;
}
public Integer getYid() {
return yid;
}
public void setYid(Integer yid) {
this.yid = yid;
}
public String getYname() {
return yname;
}
public void setYname(String yname) {
this.yname = yname;
}
public String getYnum() {
return ynum;
}
public void setYnum(String ynum) {
this.ynum = ynum;
}
public Type2 getTtype() {
return ttype;
}
public void setTtype(Type2 ttype) {
this.ttype = ttype;
}
}
package entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/*
* 员工非正常签到表
*/
@Entity
@Table(name="ygtwo")
public class ygtwo {
@Id
@GeneratedValue(generator="y-id",strategy=GenerationType.SEQUENCE)
@SequenceGenerator(name="y-id",initialValue=1,allocationSize=1,sequenceName="yuangong_id")
private Integer pid;
@Column(length=20)
private String pname;
@Column(length=20)
private String pnum;
@Enumerated(EnumType.STRING)
private Type type;//类型,是请假还是 早退或迟到
@Column(length=20)
private String lname;//代签领导名字
public ygtwo(){}
public ygtwo(String pname,String pnum,Type type,String lname){
this.lname=lname;
this.pname=pname;
this.pnum=pnum;
this.type=type;
}

public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
public String getPnum() {
return pnum;
}
public void setPnum(String pnum) {
this.pnum = pnum;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public String getLname() {
return lname;
}
public void setLname(String lname) {
this.lname = lname;
}
}
package entity;

public enum Type {
早退,迟到,旷工,因私请假,因公请假;


}
package entity;

public enum Type2 {
签到,签退;

}
配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
<!--加载hibernatte配置 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!--定义事物管理器 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="pointCut" id="execution(* src.s*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointCut"/>
</aop:config>



<bean id="ddaoImpl" class="Dao.Impl.daoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--部署 一个业务逻辑组件 -->
<bean id="s" class="service.Impl.bizImpl">
<property name="d" ref="ddaoImpl"></property>
</bean>

<bean id="loginAction" class="action.TeacherAction" scope="prototype">
<property name="s" ref="s"></property>
</bean>

<!-- more bean definitions go here -->

</beans>

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- 指定配置文件 -->
<context-param>
<!-- 初始化参数 -->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!--该监听器用于在web 启用时自动启用spring容器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


<display-name>Struts Blank</display-name>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<!-- Restricts access to pure JSP files - access available only via Struts action -->
<security-constraint>
<display-name>No direct JSP access</display-name>
<web-resource-collection>
<web-resource-name>No-JSP</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>no-users</role-name>
</auth-constraint>
</security-constraint>

<security-role>
<description>Don't assign users to this role</description>
<role-name>no-users</role-name>
</security-role>

</web-app>

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<property name="connection.username">system</property>
<property name="connection.password">system123456</property>
<property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="myeclipse.connection.profile">cz</property>
<!-- 根据需要自动创建数据 表 -->
<property name="hbm2ddl.auto">update</property>
<!-- 显示hibernate持久化操作中所生成的SQL -->
<property name="show_sql">true</property>
<!-- 罗列所有持久化类的类名 -->
<mapping class="entity.yuangong"/>
<mapping class="entity.ygtwo"/>
</session-factory>

</hibernate-configuration>
...全文
175 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
鸣鸣Amadues 2015-06-17
  • 打赏
  • 举报
回复
main在哪里?没有main不能运行的

67,514

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧