解决方案 »

  1.   

    访问路径应该是http://localhost:8080/Demo/hello/demo/doDemoQuery.action
    你中间少了一个/
      

  2.   

    不好意思,我看错了,上面回复错误,MD,csdn自己回复的帖子都不能修改。
      

  3.   

    在struts.xml的struts标签中加上一行<include file="struts-default.xml"/>
      

  4.   

    @rumlee 
    访问路径应该是http://localhost:8080/Demo/hello/demo/doDemoQuery.action
    你中间少了一个/
    -------------------------------
    正确路劲就是我上面说的..demo*是表示我访问action的时候前面需要加demo
      

  5.   

    @rumlee
    在struts.xml的struts标签中加上一行<include file="struts-default.xml"/>
    ---------------------------------------------------------------------
    加上也没用的!
      

  6.   

    <action name="demo*" class="demoAction" method="{1}">改成<action name="demo*" class="com.demo.action.DemoAction" method="{1}">呢?
      

  7.   

    把你的Sping的配置文件ApplicationContext.xml发出来看看,看看你有没有用Spring来管理你的demoAction
      

  8.   

    form里的action=?  是/hello/demodoDemoQuery.action吗?
      

  9.   

    <action name="demo*" class="com.demo.action.DemoAction" method="{1}">访问:http://localhost:8080/Demo/demo/demo_doDemoQuery.action
      

  10.   

    @xsd219222
    <action name="demo*" class="demoAction" method="{1}">改成<action name="demo*" class="com.demo.action.DemoAction" method="{1}">呢?
    --------------------------------------------------------------------------------
    这样改了也没用的.
      

  11.   

    spring配置文件:
    <?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:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
             http://www.springframework.org/schema/context
             http://www.springframework.org/schema/context/spring-context-3.0.xsd
             http://www.springframework.org/schema/tx
            http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
             http://www.springframework.org/schema/aop
             http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
             http://www.springframework.org/schema/task 
             http://www.springframework.org/schema/task/spring-task-3.0.xsd"> <!-- 启用spring注解支持 -->
    <context:annotation-config /> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.OracleDriver">
    </property>
    <property name="url" value="jdbc:oracle:thin:@192.168.1.183:1521/WSLDEV">
    </property>
    <property name="username" value="wsladmin"></property>
    <property name="password" value="password"></property>
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.Oracle9Dialect
    </prop>
    </props>
    </property>
    </bean> <!--
    定义事务处理类,不同的数据访问方式,事务处理类不同
    比如:Hibernate操作的HibernateTransactionManager,JDBC操作的使用DataSourceTransactionManager
    -->
    <bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"></property>
    </bean> <!-- 定义事务通知 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <!-- 定义方法的过滤规则 -->
    <tx:attributes>
    <!-- 所有方法都使用事务 -->
    <tx:method name="*" propagation="REQUIRED" />
    <!-- 定义所有get开头的方法都是只读的 -->
    <tx:method name="get*" read-only="true" />
    </tx:attributes>
    </tx:advice> <!-- 定义AOP配置 -->
    <aop:config>
    <!-- 定义一个切入点 -->
    <aop:pointcut expression="execution (* com.demo.dao.*.*(..))"
    id="services" />
    <!-- 对切入点和事务的通知,进行适配 -->
    <aop:advisor advice-ref="txAdvice" pointcut-ref="services" />
    </aop:config></beans>
      

  12.   

    @fangmingshijie
    form里的action=?  是/hello/demodoDemoQuery.action吗?
    --------------------------------------------------------------------
    对的.
      

  13.   

    菜鸟也可以改错啊。
    你的<package name="demo" extends="struts-default" namespace="/hello">
            <action name="demo*" class="demoAction" method="{1}">
                <result name="doDemoQuery">/jsp/demoList.jsp</result>
            </action>
        </package>
    访问的时候acion=/hello/demodoDemoQuery.action
    还有你的类名,应该为com.demo.action.DemoAction吧
      

  14.   


    <!-- 将对象交给spring管理 -->
    <constant name="struts.objectFactory" value="spring" />这个有吗?
      

  15.   

    你应该加上扫描action包的配置
       <init-param>
                <param-name>struts.convention.action.packages</param-name>
                <param-value>cn.damai.mplus.activity.channel.action</param-value>
            </init-param>
      

  16.   

    你spring 里面就没有定义demoAction 这个bean吧
      

  17.   

    如果你的项目框架中需要spring来管理你的action的话,需要在spring配置文件中加载一下,就像下面一样:
    <bean id="uploadAction" class="com.ec.action.UploadAction">
    <property name="uploadService" ref="uploadService"></property>
    </bean>
      

  18.   

    各位,就没人看他的 web.xml 文件的配置吗?!~       楼主你好,我刚刚也是被类似的问题困扰过,首先谢谢你,看完你的帖子和各位的回答我解决了我这里的问题,
    希望我的回答能给你带来帮助
            你的web.xml里面的映射
    <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>*.action</url-pattern>
    </filter-mapping>      既然楼主把<url-pattern>*.action</url-pattern>设置为了*.action那么你的URL必定是以 .action 结尾 这一点我想不会有疑问
    但是你的路径
              3.访问路劲:http://localhost:8080/Demo/hello/demodoDemoQuery.action
          为什么最后是/demodoDemoQuery.action呢?
          我看了楼主的action方法中并没有名为  demodoDemoQuery  的方法!
          如果没有 demodoDemoQuery  这个方法那么服务器怎么找得到呢?
          
          在这里我提出我的解决方法:
    1.最直接的  URL改为   http://localhost:8080/Demo/hello/doDemoQuery.action
    2.更改<url-pattern>标签值为  <url-pattern> demo*.action</url-pattern>
    3.你还可以修改struts.xml中的package标签中的namespace属性为
             namespace="/hello/demo"
                同时修改你的 访问路径为          
             http://localhost:8080/Demo/hello/demo/doDemoQuery.action希望这点内容能对楼主和每个关心这个问题的人给以帮助,希望楼主早日解决问题并结贴。
      

  19.   

    抱歉 前面的回答有误
    第二个解决方案是错误的
    其中第二个解决方案如果你需要可以设值
    struts.action.extension 常量的值
    <constant name="struts.action.extension" value =
    但是想在 action 方法名前面加其他东西是行不通的抱歉,如果有其他错误还望大家指正