WebWork2 + Spring + Hibernate Getting Started Fully Configuration Guide (2) (Original)

xiaoxiao2021-03-06  40

Then it is the configuration of Spring. Please create the ApplicationContext.xml file in web-lib /, the content is as follows org.gjt.mm.mysql.driver jdbc: mysql : // localhost / mystructs 1 COM / CZ / STRUCT / SYSTABLE.HBM.XML net.sf.hibernate.diaalect.mysqldiaalect true < Bean id = "TransactionManager" class = "

Org.SpringFramework.orm.hibernate.hibernateTransactionManager "> PROPAGATION_REQUIRED PROPAGATION_REQUIRED, readOnly PROPAGATION_REQUIRED, readOnly In this profile, we set the DataSource / SessionFactory and Spring dynamic agents, as well as the XML mapping file path required for Hibernate and then configure xwork.xml < External-ref name = "systabledao"> systabledaoproxy / index.jsp

I met a unclear joke when configuring the action of External-Ref, I met when I edited XML. It is edited in editplus. I started to write into the SYSTABLEDAOPROXY result system prompts to find beans called SYSTABLEDAOPROXY name, the result is found, find it next to it Space and tab,. . It is definitely that there is no TRIM after returning to the string, and finally our testAction.javaPackage com.cz.struct; import com.opensymphony.xwork. *; Import com.opensymphony.webwork. *; Import java.util. *; / ** * @author tijichen * * TODO to change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates * / public class TestAction extends ActionSupport {private SystableDAO systabledao; String testname = null; public void setSystableDAO (SystableDAO dao) {this.systabledao = dao;} public SystableDAO getSystableDAO () {return this.systabledao;} public String execute () throws Exception {testname = "executeing"; SystablePK pk = new SystablePK () Systable newData = new system (); pk.setfieldname ("test"); pk.settablename ("test3"); newData.setComp_ID (PK); NewData.setChineseName ("tets"); SYSTABLEDAO.INSERT (NewData); Return Action.suCcess;}} OK, compile packaging, then enter http: // localhost: 8080 / your publishing directory /TEST.Action in the browser address bar, is there a data in the database? As for others, such as the value submitted from the page into the database, etc., there are not many sayings here, the webwork comes with SAMPLE is the best reference.

转载请注明原文地址:https://www.9cbs.com/read-66321.html

New Post(0)