無法實(shí)例化的行動(dòng),cn.star.ssh.action.productaction
Unable to instantiate Action, cn.star.ssh.action.ProductAction, defined for 'product_save' in namespace '/'null
Unable to instantiate Action, cn.star.ssh.action.ProductAction, defined for 'product_save' in namespace '/'null
舉報(bào)
2018-09-18
我換成jdk1.6也沒用,用老師的第二種方法就沒問題了
2017-08-12
明明昨天用jdk1.8還好好的,今天就出問題了
2016-10-21
出現(xiàn)這種問的童鞋,jdk換到1.6就行了,要用1.8的話,spring要用4
2016-10-11
// Struts和Spring整合過程中按名稱自動(dòng)注入業(yè)務(wù)層的類
private ProductService productService;
public void setProductService(ProductService productService) {
this.productService = productService;
}
感覺是這句話沒有起作用
可是jar包已經(jīng)導(dǎo)入了啊
2016-10-11
package cn.star.ssh.action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import cn.star.ssh.entity.Product;
import cn.star.ssh.service.ProductService;
/**
?* 商品管理的Action的類
?*/
public class ProductAction extends ActionSupport implements ModelDriven<Product>{
/**
*?
*/
private static final long serialVersionUID = 1L;
// 模型驅(qū)動(dòng)使用的類
private Product product = new Product();
@Override
public Product getModel() {
return product;
}
// Struts和Spring整合過程中按名稱自動(dòng)注入業(yè)務(wù)層的類
private ProductService productService;
public void setProductService(ProductService productService) {
this.productService = productService;
}
/**
* 保存商品的執(zhí)行的方法:save
*/
public String save(){
System.out.println("Action中的save方法執(zhí)行了...");
productService.save(product);
return NONE;
}
}
2016-10-11
沒搞懂哪里錯(cuò)了?
2016-10-11
<?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:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd">
<!-- 配置業(yè)務(wù)層的類 -->
<bean id="productService" class="cn.star.ssh.service.ProductService">
<property name="productDao" ref="productDao"></property>
</bean>
<!-- 配置DAO的類 -->
<bean id="productDao" class="cn.star.ssh.dao.ProductDao">
</bean>
</beans>
2016-10-11
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
? ? "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
? ? "http://struts.apache.org/dtds/struts-2.3.dtd">
<!-- Struts2配置 -->
<struts>
<package name="ssh" extends="struts-default" namespace="/">?
<action name="product_save" class="cn.star.ssh.action.ProductAction" method="save">
</action>
</package>
? ??
</struts>