再整合ssh時,關於Spring IOC注入問題
阿新 • • 發佈:2018-11-08
No matching editors or conversion strategy found
IOC問題: EmpService bean 實現了 Iemp介面,就不能直接作為引數傳入Action裡面; 要將Iemp介面作為物件引數傳入Action,然後在Action引用介面物件裡面的方法。 Spring 容器 介面要引用EmpService實現類。 <bean id="emp" class="pojo.Emp"/> <bean id="empAction" class="action.EmpAction"> <property name="iemp" ref="empService"></property> <property name="e" ref="emp"/> </bean> <bean id="empService" class="service.EmpService"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> </beans>
not-null property references a null or transient value: pojo.Emp.name
還有一點,表單採用域模型,欄位採用e.name 方式引用, e為 Action裡面實體Emp的物件e
<s:textfield name="e.name"></s:textfield>