1. 程式人生 > >Caused by: com.opensymphony.xwork2.config.ConfigurationException: Action class [cn.com.action.Produc

Caused by: com.opensymphony.xwork2.config.ConfigurationException: Action class [cn.com.action.Produc

com.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration.

Caused by: com.opensymphony.xwork2.config.ConfigurationException: Action class [cn.com.action.Product] does not have a public no-arg constructor

Caused by: java.lang.NoSuchMethodException: cn.com.action.Product.<init>()

我是struts2的初學者,剛學就出現這個錯誤!

原因:

類裡面缺少無參的建構函式!

如果一個類裡面沒有任何建構函式,預設是無參的;

如果一個類裡面有一個有引數的建構函式,預設的無參建構函式就會被覆蓋掉