<!-- PeriodAction -->
<bean name="periodAction" class="com.shandy.scra.bas.web.PeriodAction" singleton="false">
<property name="periodService" ref="periodService"/>   //
<property name="operaService" ref="periodService"/> //这里不执行
<property name="testPrefix" value="ymf"/>
<property name="pageService" ref="pageService"></property>
</bean>我在PeriodaAction里的代码 public void setOperaService(PeriodService operaService) {
this.operaService = operaService;
this.periodService = operaService;
System.out.println("setOperaService");
} public void setPeriodService(PeriodService periodService) {
this.periodService = periodService;
System.out.println("setPeriodService");
}
public void setTestPrefix(String testPrefix) {
this.testPrefix = testPrefix;
System.out.println(this.testPrefix);
}
tomcat的输出:
22:31:35,546  WARN OgnlValueStack:46 - Could not find property [struts.valueStack]
setPeriodService  //看到没只有这里
Hibernate: select period0_.id as id29_, period0_.accPeriod as accPeriod29_, period0_.accountId as 
今天整了一天。哎。不知道怎么回事
哪位有经验的大哥碰到过这种问题吗?

解决方案 »

  1.   


    public void setOperaService(PeriodService operaService) {
    this.operaService = operaService;
    this.periodService = operaService;
    System.out.println("setOperaService");
    }
    把this.periodService = operaService;删掉呢
      

  2.   

    我怕代码太多,大家看的太烦了。
    PeriodActionpackage com.shandy.scra.bas.web;import java.io.IOException;
    import java.util.List;
    public class PeriodAction  extends AbstractAction{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private PeriodService periodService;
    private String testPrefix;

    private PeriodService operaService;
    private Period period;
    private List dataList;

    private PageService pageService;
    private Page page;
    protected String currentPage;
    protected String pagerMethod;
    protected String totalRows;


    //获取Action处理名称的前缀
    public String getActionPrefix(){
    String s = "Period";
    return s;
    }

    //设置一些公共的属性,便于前台获取
    public void setCommonAttribute()
    {
    getRequest().setAttribute("actionPrefix", this.getActionPrefix());
    }


    // 获得相应页面的数据
    public String doGetPageData() {
    int totalRow = periodService.getRows();
    int pageSize = SystemUnit.pageRows;
    page = pageService.getPager(this.getCurrentPage(), this
    .getPagerMethod(), totalRow, pageSize);
    this.setCurrentPage(String.valueOf(page.getCurrentPage()));
    this.setTotalRows(String.valueOf(totalRow));
    dataList = periodService.getList(page.getPageSize(), page.getStartRow());
    setCommonAttribute();
    return "toList";
    }

    public String doGetList(){
    dataList = periodService.getList();
    return "toList";
    }

    public String doAdd(){
    return "toAdd";
    }

    // 增加数据
    public String doCreate()throws IOException{

    this.periodService.create(this.period);

    HttpServletResponse res = ServletActionContext.getResponse ();
    res.setContentType("text/html; charset=gbk");///
    res.getWriter().write("<script>alert('更新成功!!');window.location='Currency_GetPageData.shb';window.close();</script>");

    return null;
    }

    // 更新
    public String doGetByID(){
    period =this.periodService.getById(this.period.getId());
    return "toEdit";
    }

    // 更新数据
    public String doUpdate() throws IOException{
    this.periodService.update(period);

    HttpServletResponse res = ServletActionContext.getResponse ();
    res.setContentType("text/html; charset=gbk");//Resource_GetResourceList.shb
    res.getWriter().write("<script>alert('更新成功!!');window.location='Currency_GetList.shb';window.close();</script>");

    return null;
    }

    // 删除
    public String doDelete() throws IOException{
    this.periodService.delete(period.getId()); HttpServletResponse res = ServletActionContext.getResponse ();
    res.setContentType("text/html; charset=gbk");///Resource_GetResourceInfoList.shb
    res.getWriter().write("<script>alert('更新成功!!');window.location='Currency_GetList.shb';window.close();</script>");

    return null; //"toViewMenu";
    }
    public String getCurrentPage() {
    return currentPage;
    } public void setCurrentPage(String currentPage) {
    this.currentPage = currentPage;
    } public String getPagerMethod() {
    return pagerMethod;
    } public void setPagerMethod(String pagerMethod) {
    this.pagerMethod = pagerMethod;
    } public String getTotalRows() {
    return totalRows;
    } public void setTotalRows(String totalRows) {
    this.totalRows = totalRows;
    } public PageService getPageService() {
    return pageService;
    } public void setPageService(PageService pageService) {
    this.pageService = pageService;
    } public Page getPage() {
    return page;
    } public void setPage(Page page) {
    this.page = page;
    }
    public Period getPeriod() {
    return period;
    }
    public void setPeriod(Period period) {
    this.period = period;
    } public PeriodService getPeriodService() {
    return periodService;
    } public void setPeriodService(PeriodService periodService) {
    this.periodService = periodService;
    System.out.println("setPeriodService");
    } public PeriodService getOperaService() {
    return operaService;
    } public void setOperaService(PeriodService operaService) {
    this.operaService = operaService;
    this.periodService = operaService;
    System.out.println("setOperaService");
    } public List getDataList() {
    return dataList;
    } public void setDataList(List dataList) {
    this.dataList = dataList;
    } public String getTestPrefix() {
    return testPrefix;
    } public void setTestPrefix(String testPrefix) {
    this.testPrefix = testPrefix;
    System.out.println(this.testPrefix);
    }}配置文件<?xml version="1.0" encoding="GB2312"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans><!--    ****************************   Dao    ****************************    -->
    <!--    ****************************   说明    ****************************    -->

    <!-- CurrencyDao -->
    <bean id="currencyDao" class="com.shandy.scra.bas.dao.impl.CurrencyDaoImpl">
    <property name="genericDao" ref="genericDao"/>
    </bean>

    <!-- PeriodDao -->
    <bean id="periodDao" class="com.shandy.scra.bas.dao.impl.PeriodDaoImpl">
    <property name="genericDao" ref="genericDao"/>
    </bean>

    <!--    ****************************   Service    ****************************    -->
    <!--    ****************************   说明    ****************************    -->
    <!-- CurrencyService -->
    <bean id="currencyService" class="org.springframework.aop.framework.ProxyFactoryBean">
     <property name="proxyInterfaces">
       <value>com.shandy.scra.bas.service.CurrencyService</value>
     </property>
     <property name="target">
     <bean class="com.shandy.scra.bas.service.impl.CurrencyServiceImpl">
    <property name="generalDao" ref="currencyDao"/>
     </bean>
     </property>
    </bean>

    <!-- PeriodService -->
    <bean id="periodService" class="org.springframework.aop.framework.ProxyFactoryBean">
     <property name="proxyInterfaces">
       <value>com.shandy.scra.bas.service.PeriodService</value>
     </property>
     <property name="target">
     <bean class="com.shandy.scra.bas.service.impl.PeriodServiceImpl">
    <property name="generalDao" ref="periodDao"/>
     </bean>
     </property>
    </bean>

    <!--    ****************************   Action    ****************************    -->
    <!--    ****************************   基础资料    ****************************    -->

    <!-- CurrencyAction -->
    <bean name="currencyAction" class="com.shandy.scra.bas.web.CurrencyAction" singleton="false">
    <property name="currencyService" ref="currencyService"/>
    <property name="pageService" ref="pageService"></property>
    </bean>

    <!-- PeriodAction -->
    <bean name="periodAction" class="com.shandy.scra.bas.web.PeriodAction" singleton="false">
    <property name="periodService" ref="periodService"/>
    <property name="operaService" ref="periodService"/>
    <property name="testPrefix" value="ymf"/>
    <property name="pageService" ref="pageService"></property>
    </bean>

    </beans>
      

  3.   


    <?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <!-- A Local dataSource Definition using c3p0 connection pool -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass"  value ="${connection.driver_class}"/>
    <property name="jdbcUrl"  value ="${jdbc.connection.url}"/>
    <property name="idleConnectionTestPeriod"  value ="${jdbc.pool.c3p0.idle_connection_test_period}" />
    <property name="maxIdleTime"  value ="${jdbc.pool.c3p0.max_idle_time}" />
    <property name="properties">
    <props>
    <prop key="user">${jdbc.connection.username}</prop>
    <prop key="password">${jdbc.connection.password}</prop>
    <prop key="c3p0.acquire_increment">${jdbc.pool.c3p0.acquire_increment}</prop>
    <prop key="c3p0.max_size">${jdbc.pool.c3p0.max_size}</prop>
    <prop key="c3p0.min_size">${jdbc.pool.c3p0.min_size}</prop>
    </props>
    </property>
    </bean>

        <!-- DaoSupport config -->
    <bean id="daoSupport" class="org.ageless.component.hibernate.impl.DaoSupportHibernate3Imp">
         <property name="sessionFactory"><ref bean="sessionFactory"/></property>
        </bean>
        
        <!-- GenericDao config -->
    <bean id="genericDao" class="org.ageless.component.hibernate.BaseDao">
    <property name="daoSupport"><ref bean="daoSupport"/></property>
    </bean>

    <!-- set DAO -->
    <bean id="Dao" class="org.ageless.component.hibernate.impl.DAOHibernate" lazy-init="true"></bean>
    </beans>