Eclipse development struts Complete Guide
One for the installer
1, JDK 5.0 installation program download
Download Address:
Agree with the agreement, can be downloaded jdk-1_5_0_05-windows-i586-p.exe.
2, tomcat 5.5.9 Download
Download Address: http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
The latest version is 5.5.11 alpha version because it is beta, so there may be an element of uncertainty, which is why we here to download the 5.5.9 exe.
3, Sysdeo Eclipse Tomcat Launcher plugin 3.1beta edition
Download Address: http://www.sysdeo.com/eclipse/tomcatplugin
TomcatPluginV31beta.zip here to download.
4, eclipse 3.1 installation program download
Download Address: http://www.eclipse.org/downloads/index.php
It should be corresponding version of the JDT, if you download the Eclipse SDK versions own, and if not, with a download page on after some of the JDT download links, download the corresponding documents will be copied into eclipse respectively installation directory the corresponding documents folder.
Here we download eclipse-SDK-3.1-win32.zip.
5, GEF 3.1 installation program download
Download Address:
Http://download.eclipse.org/tools/gef/downloads/drops/R-3.1-200507071758/
Index.php
Here we download GEF-ALL-3.1.zip.
6, Eclipse HTML Editor 1.6.7 installer download
Download Address: https: / / sourceforge.jp / projects / amateras / files /? Release_id = 16537
# 16537
Here we Download: tk.eclipse.plugin.htmleditor_1.6.7.zip.
7, StrutsIDE 1.1.7 installer download
Download Address: https: / / sourceforge.jp / projects / amateras / files /? Release_id = 16537 # 16537
Here we Download: tk.eclipse.plugin.struts_1.1.7.zip.
Well, here we all ready for the installation of the package.
Second, install and configure the development environment JDK
JDK here need only double-click on the exe file installation package, in accordance with tips can be installed. After the installation is complete, JDK installed under the bin directory folder settings into the path environment variable PATH to. At the same time, the JRE lib directory of rt.jar packages installed into the environment variable to the classpath.
Here we JDK installed on the default installation path C: \ Program Files \ Java \ jdk1.5.0_02 under. Here is not to say, the Internet can search many JDK installation configuration articles.
Third, the installation tomcat server
Tomcat need only double-click on the exe file installation packages, and can be installed in accordance with the tips, here we install directory to D: \ Tomcat5.5, the administrator password is set to 12345678.
4, installation Eclipse development tools
Need only to eclipse-SDK-3.1-win32.zip install decompression, and then inside the eclipse folder shear to the directory to be placed, where we have installed to eclipse the D: \ eclipse directory.
Double-click the installation directory eclipse.exe documents, you will start eclipse. Middle will ask the default working directory, you can according to their default settings, you can also set their own working directory, here set to E: \ workspace directory. Select Use this as the default and do not ask again options after this start will not be asked to.
Eclipse the success of this installation.
5, plug-in installed tomcatPlugin
Installation is very simple, we have to extract the downloaded installation package tomcatPluginV31beta.zip will extract the com.sysdeo.eclipse.tomcat_3.1.0.beta folder copy to the D: \ eclipse \ plugins directory can be. We turn off the eclipse has been opened, re-opened, OK, we are now found on the toolbar more than a few Tomcat icon is the tomcat start, stop and restart button. Eclipse the open window / preferences, we have trees on the left can also be found a tomcat.
Click tomcat items, we have chosen the right version 5.x version, and then set tomcat home to the D: \ Tomcat5.5, Contexts directory to D: \ Tomcat5.5 \ conf \ Catalina \ localhost. Completion of this tomcat plugin installed.
6, installation GEF Plugin
Similarly, the GEF-ALL-3.1.zip decompress, and then copy decompression after the eclipse directory of the three folders to the D: \ eclipse directory covering all existing folder.
Well, this GEF installation is complete.
8, creating a test project
If you have completed all the above steps can now be restarted eclipse, the newly installed plug-in force, officially developed.
1, the use of Sysdeo Tomcat Plugin create tomcat works:
File-> new-> others, open new Wizard dialog box, a tree found in java-> tomcat projects, selected, click the next button. Enter in the projects name textweb, select Use default, click next. The next Talk to maintain the default settings, click finished. At this time, we have the package explorer eclipse will be seen in the new project testweb to create complete.
2, by adding struts framework
File-> new-> others, open new Wizard dialog box, find Amateras-> Struts-> Add Struts Support, select next button click.
Keep the default settings, click the Finish button. Then, in the package explorer eclipse will be seen in the increase in a lot of struts of the library in the WEB-INF also increased under a lot of struts configuration files. In this project we have joined the Struts framework.
3, edit struts-config.xml file
In the WEB-INF folder can be found, right-click menu options open with-> Amateras XML Editer can directly edit the xml text, select open with-> struts-config.xml editor in the graphics mode of documents edit.
On the right side click on the outline of the struts objects can be added into a new object. Here, we note here is a more convenient struts-config.xml file editor, we will be behind the development of a simple small procedures.
4, a new page index.jsp
File-> new-> others, open new Wizard dialog box, find Amateras-> JSP File, click the next button, FileName to index.jsp, click Finish. Then open index.jsp document for editing, as follows:
5, create data objects form
Open File-> new-> package dialog box, enter com.is.form name, and click Finish button. Package Explorer in the right of the tree to find just the creation package, right-click com.is.form package, the new menu-> others, find Amateras-> struts-> Struts Action Form, click next, in the name in the dialog box LoginForm input column, click Finish button.
Edit the contents of LoginForm categories:
Note that the two properties were jsp our counterparts in the form of the name of the two input controls, why do so, can look at the struts with the help of documents, I do not detail, also finished form another category attributes, get and set methods can eclipse the source of commands to automatically generate, in the pop-up menu, no detail, to check information on the Internet bar, the use of the eclipse there are many documents.
7, plug-in installed Eclipse HTML Editor
Decompress tk.eclipse.plugin.htmleditor_1.6.7.zip packets, and then copy plugins directory to D: \ eclipse directory covering the original document folder. Eclipse HTML Editor plug-in this installation is complete.
8, plug-ins installed StrutsIDE
Decompress tk.eclipse.plugin.struts_1.1.7.zip packets, and then copy plugins directory to D: \ eclipse directory covering the original document folder.
Well, here StrutsIDE plug-in installed.
6, objects to create action
The same process to create the same form, we are only a com.is.action new package, the same process, opened new wizard, but choose Struts Action, create LoginAction.java type, default value of the election. We edit LoginAction as follows:
try (if (form instanceof LoginForm) (LoginForm theForm = (LoginForm) form; if (theForm.getUsername (). equals ( "user") & & theForm.getPassword (). equals ( "123456")) (return new ActionForward ( "/ welcome.do? type = true");) else (return new ActionForward ( "/ welcome.do? type = false");))) catch (Exception e) () / / this shouldn't happen in this example return null;))
Attention here is the direct use of ActionForward to, and you can also provide the blank struts routines struts-blank.war practices in turn, can be compared to the harvest.
7, pages created successful login
Index.jsp with the creation of the same pages, we create welcome.jsp page, use the default settings. And edit its content as follows:
8, the increase in Struts-config.xml configuration
Add formbean configuration,
Add jsp document mapping,
Add action document mapping,
We can run this test procedure.
9, testing procedures
Right-click testweb project root directory, click on the menu Tomcate project-> update context definition, the project will be deployed into the tomcat, after the success will be prompted to operate successfully.
Click on the menu bar icon Tomcat start tomcat, and then enter the address bar in IE http://localhost:8080/testweb/index.do, we will see index.jsp content pages.






