Some ideas for the SME platform and the experience of the company's 3 days

xiaoxiao2021-03-18  196

Come to the company for 3 days, it feels good, no matter whether it is technical or colleagues. Regardless of whether it can be left, it is a precious wealth. Oh, of course, I am confident to myself.

The R1 platform is from which the company is soft introduced. We are said to train this new platform. When I saw it for the first time, I thought it was a simple Eclipse plugin, and later saw its entire architecture. It turned out to be a quick development platform, which packaged "everything". Model is fully encapsulated in servlet and handler, servlet inherits from its own class servletBase, and Handler is mainly packaged in packaging business. Control is controlled by a servlet or deployment file in accordance with a general architecture. The entire system uses Servlet's Filter technology to perform permission control and character conversion.

The application of this platform development and database interaction is simple, first establish a connection (in R1 Studio, a plug-in), set a DAO object, you can choose to generate a Vo (Value Object). Then establish a servlet will automatically generate a servlet and handler. Handler encapsulates, delete, reform, search, bulk, bulk deletion, etc., which is actually implemented by a DAOFActory, but you must provide primary keys in Dao, which makes such an operation according to this primary key. The servlet is processed, obtains form data, processes and handles the JavaBean, and then Forward to JSP files. Establish a JSP file, R1 just provides a touch of functionality, including paging programs, if you want to actually use, you are afraid you have to write yourself. R1 puts a query out in the list, and then pass it into the request, and then it to the specific page. For judgment operation types, the hidden Operate property in the form submitted in the JSP file is determined, and then the method in the corresponding Handler is called. The above is just a simple process. After all, I have also been in contact with two days.

The main type of reference code is as follows:

DAO class

Package com.icss.test.demo.baseinfomanage.da;

Import java.sql.connection;

Import com.icss.j2ee.dao.dao; import com.icss.j2ee.dao.daoException;

Public Class Rmstestdao Extends Dao {

Public String ID; public string name;

Public rmstestdao () {super ();

Public RMSTestDao (Connection Conn) {Super (conn);

Public java.lang.string getId () {return id;} public void setid (java.lang.string _id) {FirePropertyChange ("ID", ID, _ID); id = _id;} public java.lang.String GetName ) {return name;} public void setName (java.lang.String _name) {firePropertyChange ( "name", name, _name); name = _name;} protected void setupFields () throws DAOException {addField ( "id", "ID "); AddField (" Name "," name "); settablename (" rmstest "); addkey (" id "); // Provides primary key}}

VO class:

Package com.icss.test.demo.baseinfomanage.vo;

Import com.icss.j2ee.vo.valueObject;

Public class rmstestvo1 extends valueObject {

Public String ID; public string name;

Public Java.lang.String getId () {return ID;} public void setid (java.lang.string _id) {id = _id;} public java.lang.string getName () {return name;} public void setname (Java .lang.string _name) {name = _name;}}

Servlet class segment:

Try {conn = getConnection ("java: comp / env / jdbc / cigmisdb"); string id = request.getParameter ("ID"); string name = request.getParameter ("name"); string operate = request.getParameter "Operate"); if (id == null) id = "" "; if (name == null) Name =" "; RMSTestDao Rmstestdao = new rmstestdao (); rmstestdao.setID (ID); // Set primary key

RmstestHandler rmstestHandler = new RmstestHandler (conn); if (operate.equals ( "insert")) {rmstestDAO.setName (name); rmstestHandler.create (rmstestDAO);} else if (operate.equals ( "modify")) {rmstestDAO .setName (name); rmstestHandler.update (rmstestDAO, true);} else if (operate.equals ( "remove")) {rmstestHandler.delete (rmstestDAO);} String dist = "/ servlet / baseinfomanage / MyServlet"; forward (Request, response, dist);} catch (exception e) {handleError (e);} finally {.....} Handler class segment:

Public RMSTestHandler (Connection CONN) {this.conn = conn; factory = new daofactory (conn);

Public void create (rmstestdao rmstestdao) throws daoException {rmstestdao.setConnection (conn); rmstestdao.create ();}

Public void Update (RMStestdao Rmstestdao, Boolean UpdateByprimarykey) THROWS DAOEXCEPTION {RMSTestDao.SetConnection (conn); rmstestdao.update (UpdateByPrimaryKey);}

/ ** Parameter DAO must contain primary keys * Otherwise, use BatchDelete method * / public void delete (rmstestdao rmstestdao) throws daoException {rmstestDao.setConnection (); rmstestdao.delete ();}

/ ** Did not find VO * corresponding to RMSTestDao, so the query result is returned is DAO List * / public List Find (RMSTestDao Rmstestdao) THROWS DAOException {Factory.SetDao (RMStestDao); list result = factory.find (); return results }

/ ** not found in the RmstestDAO VO * returns the query result is an instance of DAO * / public RmstestDAO findByPrimaryKey (RmstestDAO rmstestDAO) throws DAOException {factory.setDAO (rmstestDAO); return (RmstestDAO) factory.findByPrimaryKey ();}

public void batchUpdate (RmstestDAO rmstestDAO) throws DAOException {factory.setDAO (rmstestDAO); factory.batchUpdate ();} public void batchDelete (RmstestDAO rmstestDAO) throws DAOException {factory.setDAO (rmstestDAO); factory.batchDelete ();}

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

New Post(0)