struts+spring+hibernate搞了一天,總是有Servlet action is not available異常,高手指教一下
一開始我先是struts1.1 + spring1.2.6,沒有問題,一切正常
後來我加上hibernate3,改動applicationContext.xml後,編譯是總是產生The requested resource (Servlet action is not available) is not available.異常,高手幫我看一下有什麼問題
struts-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config >
<form-beans>
<form-bean name="loginform" type="com.ssh.pro.form.LoginForm" />
</form-beans>
<action-mappings>
<action input="index.jsp" name="loginform" path="/login" scope="request" type="org.springframework.web.struts.DelegatingActionProxy" validate="false">
<forward name="success" path="/admin/LoginSuccess.jsp" />
</action>
</action-mappings>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
</plug-in>
</struts-config>
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean name="/login" class="com.ssh.pro.action.LoginAction" singleton="false">
<property name="manageinfoDAO">
<ref bean="manageinfoDAOProxy" />
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@10.10.10.112:1521:orcl</value>
</property>
<property name="username">
<value>trms</value>
</property>
<property name="password">
<value>trmswaygoing</value>
</property>
</bean>
<!--sessionFactory-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/ssh/pro/dto/Manageinfo.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="manageinfoDAO" class="com.ssh.pro.dao.ManageinfoDAO">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="manageinfoDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="manageinfoDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
</beans>
DAO:
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class ManageinfoDAO extends HibernateDaoSupport{
private static String hql = "from Manageinfo m where m.username=? ";
public boolean isValidUser(String username, String password) {
List userList = this.getHibernateTemplate().find(hql, username);
if (userList.size() > 0) {
return true;
}
return false;
}
}
後來我加上hibernate3,改動applicationContext.xml後,編譯是總是產生The requested resource (Servlet action is not available) is not available.異常,高手幫我看一下有什麼問題
struts-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config >
<form-beans>
<form-bean name="loginform" type="com.ssh.pro.form.LoginForm" />
</form-beans>
<action-mappings>
<action input="index.jsp" name="loginform" path="/login" scope="request" type="org.springframework.web.struts.DelegatingActionProxy" validate="false">
<forward name="success" path="/admin/LoginSuccess.jsp" />
</action>
</action-mappings>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
</plug-in>
</struts-config>
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean name="/login" class="com.ssh.pro.action.LoginAction" singleton="false">
<property name="manageinfoDAO">
<ref bean="manageinfoDAOProxy" />
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@10.10.10.112:1521:orcl</value>
</property>
<property name="username">
<value>trms</value>
</property>
<property name="password">
<value>trmswaygoing</value>
</property>
</bean>
<!--sessionFactory-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/ssh/pro/dto/Manageinfo.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="manageinfoDAO" class="com.ssh.pro.dao.ManageinfoDAO">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="manageinfoDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="manageinfoDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
</beans>
DAO:
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class ManageinfoDAO extends HibernateDaoSupport{
private static String hql = "from Manageinfo m where m.username=? ";
public boolean isValidUser(String username, String password) {
List userList = this.getHibernateTemplate().find(hql, username);
if (userList.size() > 0) {
return true;
}
return false;
}
}
相關文章
- Servlet action is not availableServletAI
- 高手指教
- struts2的異常There is no Action mapped for namespace / and action nameAPPnamespace
- No Bean named 'Xxx' available 異常報錯BeanAI
- 什麼是異常?python處理異常的方式有幾種?Python
- 請高手指教,EJB容器是不是在截獲一個非檢查異常時就回滾事務。
- 本人首次自己試破解(請各位高手指教一下) (1千字)
- 高手指教,關於iPlanet
- 一個關於Struts Action的小框架, 請高手指點一下框架
- 有關JBPM3配置時一個無法找到ORACLE JDBC DRIVER的異常,請高手進來幫忙一下!OracleJDBC
- jboss問題,請各位高手指教!
- Spring Boot學習之No bean named 'entityManagerFactory' available異常Spring BootBeanAI
- 異常小總結
- oracle異常彙總Oracle
- 什麼是異常
- Hadoop異常總結Hadoop
- Struts+hibernate+tomcat開發ERP風險有多大?請高手指教!Tomcat
- 什麼是中斷?什麼是異常?它們有何區別?
- xml方面的的問題,請高手指教XML
- 有關java程式不能在linux上執行的問題,請高手指教JavaLinux
- python異常大總結Python
- OOM異常型別總結OOM型別
- Java常見知識點彙總(⑨)——異常Java
- 不懂下面struts頁面的集合是什麼時候產生的,請高手指教
- 關於J2EE安全請高手指教
- jive2.1.2快取問題?各位高手,請指教!!快取
- 請高手幫我看一下這是怎麼回事
- 請教一下高手
- 課時32:異常處理:你不可能總是對的
- 是人為shutdown,還是異常宕庫?
- java異常知識點彙總Java
- 異常聲音檢測總結
- 關於j_security_check的問題 高手請指教
- jive2.1.2快取問題?各位高手,請指教!!急快取
- 課時33:異常處理:你不可能總是對的2
- 【Java面試】請簡單說一下你對受檢異常和非受檢異常的理解Java面試
- 異常總結2013-03
- 問一個小的運算問題,請高手指教!