亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

無法實例化的行動,cn.star.ssh.action.productaction

Unable to instantiate Action, cn.star.ssh.action.ProductAction, defined for 'product_save' in namespace '/'null

正在回答

8 回答

我換成jdk1.6也沒用,用老師的第二種方法就沒問題了

0 回復 有任何疑惑可以回復我~

明明昨天用jdk1.8還好好的,今天就出問題了

0 回復 有任何疑惑可以回復我~

出現這種問的童鞋,jdk換到1.6就行了,要用1.8的話,spring要用4

6 回復 有任何疑惑可以回復我~
#1

理工喵的故事

是這樣的,我改用1.7也過了。。。
2016-11-05 回復 有任何疑惑可以回復我~
#2

理工喵的故事

我想問下,你是怎么知道的? 要不是看到你這里,估計這問題解決不了。
2016-11-05 回復 有任何疑惑可以回復我~
#3

慕粉3988581

強! 同問:為什么?
2016-12-22 回復 有任何疑惑可以回復我~

// Struts和Spring整合過程中按名稱自動注入業務層的類

private ProductService productService;


public void setProductService(ProductService productService) {

this.productService = productService;

}

感覺是這句話沒有起作用

http://img1.sycdn.imooc.com//57fc9f2f0001bbe602360067.jpg

可是jar包已經導入了啊

0 回復 有任何疑惑可以回復我~
#1

Night離

重新放到lib目錄下試試
2017-03-01 回復 有任何疑惑可以回復我~

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;

// 模型驅動使用的類

private Product product = new Product();

@Override

public Product getModel() {

return product;

}

// Struts和Spring整合過程中按名稱自動注入業務層的類

private ProductService productService;


public void setProductService(ProductService productService) {

this.productService = productService;

}


/**

* 保存商品的執行的方法:save

*/

public String save(){

System.out.println("Action中的save方法執行了...");

productService.save(product);

return NONE;

}

}


0 回復 有任何疑惑可以回復我~

沒搞懂哪里錯了?

0 回復 有任何疑惑可以回復我~

<?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">



<!-- 配置業務層的類 -->

<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>


0 回復 有任何疑惑可以回復我~

<?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>


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

無法實例化的行動,cn.star.ssh.action.productaction

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號