Business graphics:
Preparations
Set the Basic Environment of myeclipse:
1. Set the encoding. Windows -- prefer... -- General -- workspace, modify the encoding to UTF-8
2. Modify the JDK compilation version. Java -- compiler. Modify the JDK compilation version to 6.0.
3. add your own JDK. Java -- installed jres, click Add, Click Browse, and select the JDK path you have installed. Select the JDK you just added by default.
4. Configure myeclipse to start Tomcat. Myeclipse -- servers -- Tomcat 6. x -- JDK, select the JDK added in the previous step. Select enable for Tomat server and tomcat home directory to select your Tomcat path.
Create a DHMI plug-in project:
1. Right-click -- New -- Java project.
2. Write the project name and click Finish.
3. Create a lib directory. Copy all jar packages under the root/WEB-INF/lib directory to this directory.
4. Right-click the project -- prefer... -- Java build path -- libraries -- add jars, select all jar packages, and import them.
5. Import the J2EE jar package. Java build path -- libraries -- add library -- myeclipse library. Find J2EE 1.4 librarys, select, and click Finish.
Official start
1. Create a home. XML, list. XML, and detail. XML template in MSC format.
Note: add the header <DHMI type = Response>... </DHMI>
- <dhmi type="response">- <msc type="form" action="?action=query@mdpdhmi&configid=team&m=list@news&name=zhengkaize">- <body> <input type="text" name="username" /> <input type="submit" name="submit" caption="submit" /> </body> </msc> </dhmi>
<DHMI type = "response">-<MSC type = "form" xmlns = "http: /// msc_form.d-heaven.com/ui2.0 ">-
Detail. xml
-<DHMI type = "response">-<MSC type = "form" xmlns = "http: // msc_form.d-heaven.com/ui2.0 ">-
2. Configure MDP
<MDP: DHMI-config id = "team" Source = "http: // 127.0.0.1: 8080/DHMI. do "localsource =" http: // 127.0.0.1: 8081 "appid =" bvcxek "> </MDP: DHMI-config>
3. Create a module class
Package COM. dheaven. DHMI. module; import Java. io. ioexception; import Java. util. list; import Org. dom4j. document; import Org. dom4j. element; import Org. dom4j. node; import COM. dheaven. DHMI. framework. module. basemodule; import COM. dheaven. DHMI. framework. templator. minitemplator; import COM. dheaven. DHMI. framework. templator. minitemplator. templatesyntaxexception; import COM. dheaven. DHMI. framework. util. dhmiframewokutil; Public class teamnewsmodule extends basemodule {@ overridepublic void execute () {log. debug ("Enter teammodule ............... "); system. out. println ("parameter name:" + this. method); minitemplator M = NULL; If (this. method. equalsignorecase ("home") {try {M = new minitemplator (this. gettemplatefilepath ("home. XML ");} catch (templatesyntaxexception e) {// todo auto-generated catch blocke. printstacktrace ();} catch (ioexcep Tion E) {// todo auto-generated catch blocke. printstacktrace ();} log. debug ("go to home ............... "Too many this.doc umentresponse = m. generatedocumentoutput (); this. sendresponse (); log. debug ("Exit home ............... ");} else if (this. method. repeated signorecase ("list") {try {M = new minitemplator (this. gettemplatefilepath ("list. XML ");} catch (templatesyntaxexception e) {// todo auto-generated catch blocke. printst Acktrace ();} catch (ioexception e) {// todo auto-generated catch blocke. printstacktrace ();} document DOC = dhmiframewokutil. requrl ("http: // 192.168.2.134: 8088/search. do? Name = "+ this. getstringdata ("username"), ""); element titlenode = (element) Doc. selectsinglenode ("// memo"); M. setvariable ("title", titlenode. getstringvalue (); List <element> listnamenodes = Doc. selectnodes ("// List"); For (INT I = 0; I <listnamenodes. size (); I ++) {M. setvariable ("href ","? Action = query @ mdpdhmi & configid = team & M = detail @ News & id = "+ listnamenodes. get (I ). selectsinglenode (". /ID "). gettext (); M. setvariable ("listcellcaption", listnamenodes. get (I ). selectsinglenode ("name "). gettext (); M. addblock ("list" contains too many this.doc umentresponse = m. generatedocumentoutput (); this. sendresponse ();} else if (this. method. equalsignorecase ("detail") {try {M = new minitemplator (this. gettemplatefilepath ("DETA Il. XML ");} catch (templatesyntaxexception e) {// todo auto-generated catch blocke. printstacktrace ();} catch (ioexception e) {// todo auto-generated catch blocke. printstacktrace ();} document DOC = dhmiframewokutil. requrl ("http: // 192.168.2.134: 8088/Show. do? Id = "+ this. getstringdata ("ID"), ""); log. debug ("go to settings ............... "); M. setvariable ("title", Doc. selectsinglenode ("// memo "). gettext (); M. setvariable ("content", Doc. selectsinglenode ("// content" pai.gettext({%%%this.doc umentresponse = m. generatedocumentoutput (); this. sendresponse (); log. debug ("Exit settings ............... ");}}}
4. Add the module name to the. Property file.
News = com. dheaven. DHMI. Module. teamnewsmodule
5. Add Link
<grid mode="3"><item caption="home" icon="img/1.png" href="?action=query@mdpdhmi&configid=team&m=home@news" target="_blank" /></grid>
Principles