struts 不执行java_maven整合的SSH,struts2无法执行对应action的问题(action类没有被实例化?)...

主要跳转页面为404,控制台不报错。。

下面是index.jsp页面

c1f610bd8ddbcb57b6cb2a5de9c9300f.png

点击链接跳转到404

6fac9ae45539295e0c57134b3fb021f2.png

控制台部分信息(我在service类和dao类中添加了”static{System.out.print("XX========")}“这句话所以控制台有显示)二月 20, 2017 6:32:35 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from file [C:\Users\k570\NeonWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SSH-1\WEB-INF\classes\applicationContext.beans.xml]

二月 20, 2017 6:32:35 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from file [C:\Users\k570\NeonWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SSH-1\WEB-INF\classes\applicationContext.xml]

二月 20, 2017 6:32:36 下午 org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties

信息: Loading properties file from class path resource [db.properties]

Dao====================================

二月 20, 2017 6:32:36 下午 com.mchange.v2.log.MLog 

信息: MLog clients using java 1.4+ standard logging.

二月 20, 2017 6:32:36 下午 com.mchange.v2.c3p0.C3P0Registry banner

信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

二月 20, 2017 6:32:39 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager

信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 2vsidn9mp9rw8y17kco88|5854e24c, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 2vsidn9mp9rw8y17kco88|5854e24c, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, jdbcUrl -> jdbc:mysql:///ssh, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]

Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

service========================================

二月 20, 2017 6:32:42 下午 org.springframework.web.context.ContextLoader initWebApplicationContext

信息: Root WebApplicationContext: initialization completed in 6972 ms

二月 20, 2017 6:32:44 下午 org.apache.coyote.AbstractProtocol start

信息: Starting ProtocolHandler [http-nio-8080]

二月 20, 2017 6:32:44 下午 org.apache.coyote.AbstractProtocol start

信息: Starting ProtocolHandler [ajp-nio-8009]

二月 20, 2017 6:32:44 下午 org.apache.catalina.startup.Catalina start

信息: Server startup in 12652 ms

下面是项目结构

3d5ef07632a08508334d03bd0191dc67.png

以下按照一般流程贴代码---actions.EmployeeAction(我在这个类中初始化时向控制台打印一句话,方法中也添加了,然而控制台并没有打印这个类中的任何一句话)package actions;

import java.util.Map;

import org.apache.struts2.interceptor.RequestAware;

import com.opensymphony.xwork2.ActionSupport;

import service.EmployeeService;

public class EmployeeAction extends ActionSupport implements RequestAware{

static{

System.out.println("是否进入此类?-------------------------");

}

private static final long serialVersionUID = 1L;

private EmployeeService employeeService;

public void setEmployeeService(EmployeeService employeeService) {

this.employeeService = employeeService;

}

public String list() {

request.put("employees", employeeService.getAll());

System.out.println("====================方法被执行===================");

return "list";

}

private Map request;

@Override

public void setRequest(Map arg0) {

this.request = arg0;

}

}

---service.EmployeeServicepackage service;

import java.util.List;

import dao.EmployeeDao;

import entity.Employee;

public class EmployeeService {

static{

System.out.println("service========================================");

}

private EmployeeDao employeeDao;

public void setEmployeeDao(EmployeeDao employeeDao) {

this.employeeDao = employeeDao;

}

public List getAll() {

return employeeDao.getAll();

}

}

---dao.EmployeeDaopackage dao;

import java.util.List;

import org.hibernate.Session;

import org.hibernate.SessionFactory;

import entity.Employee;

public class EmployeeDao {

static{

System.out.println("Dao====================================");

}

private SessionFactory sessionFactory;

public void setSessionFactory(SessionFactory sessionFactory) {

this.sessionFactory = sessionFactory;

}

/**获取session,因为包含事务所以选用getCurrentSession()方法来获取

* @return

*/

public Session getSession(){

return this.sessionFactory.getCurrentSession();

}

public List getAll() {

String hql = "FROM Employee";

return getSession().createQuery(hql).list();

}

}

//提问中有字数限制所以在下面提问中补充相关配置文件代码。。。。。。。。。。。。。。。。。。。。。。。。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值