JBuilder may be the most popular Java development tool, but it is not free. It will automatically send information to Borland in the latest version of JBuilder9, which is easy to be used to use pirated . Struts is now the most popular Web system architecture, and JBuilder9 comes with Struts 1.0. Of course, I personally still like Borland's products, but because of variety of reasons, the company has changed from Oracle's JDeveloper. JDeveloper1.0 is Oracle, bought JBuilder code from Borland, and heard very little. However, starting from JDeveloper 3.0, JDeveloper starts integrating Oracle's BC4J development component (this is a very powerful, easy-to-use development component), and JDevelPoer has begun to receive attention. Below, I will introduce how to develop the Struts system on the JDeveloper903.
Preparation
1.1 Download JDeveloper
First, download the latest version of JDeveloper9.03.3 from Oracle's website, JDeveloper is free.
1.2 About OC4J
An application server OC4J of Oracle is also bringing in JDeveloper. Unzip the downloaded compressed package, the J2EE folder under the JDeveloper directory is the directory where OC4J is located. If you want to start OC4J manually, we can perform Java? Cjar Oc4j.jar in its directory. OC4J usage and features are not described in detail here.
Two development struts system
2.1 Run JDeveloper
JDEVW.exe in [JDeveloperHome] JDEV / BIN in the directory where JDeveloper is located is the running program of JDeveloper in Windows. The rear interface running the JDeveloper is as follows:
figure 1
JDeveloper's Struts Development supports the latest version Struts1.1 of Struts, and provides the Struts Development Wizard. Below, we will show how to develop the Struts system with JDeveloper.
2.2 Build a struts system environment
1) First, we have to create a workspace (Workspace). There is a root workspace in JDeveloper, right-click on the root workspace, select "New Workspace ..." to create a new workspace in the pop-up menu.
2) Create an empty project called StrustDemo via FILE | New ... | General | Empty Project.
3) Complete the creation of the Struts development environment through the Struts System Wizard in new work.
In the File | New menu, select Struts under the branched Web-Tier, select "Starter Application" in the option on the right, click the "OK" button.
figure 2
Completed the above steps, a Struts developed the environment. From JDeveloper we can see the wizard adds web.xml, struts-config.xml, and a proterties file to our project.
2.3 Development Example of a Struts
This is just a simple instance, the user enters the URL, will pop up a JSP page, enter user information in the JSP page and submit, will display a list of information on the same page.
2.3.1 Editing Struts-Config.xml File
First, we add ActionMApping in Struts-Config.xml, which is used to receive the DynaActionForm for receiving user input information.
Right-click Struts-Config.xml, select the Edit Struts Config ... item in the pop-up menu, and the editor of the struts-config.xml file will pop up. image 3
As can be seen from Figure 3, JDevelPoer provides us with tools for configuring struts-config.xml files.
1) Select the Form Beans branch to add an actionform
Figure 4
2) First select the action mapping branch, then add two actionmapping, set the following
Figure 5
Figure 6
From Figure 3 we can see, you can also edit the new features of Struts 1.1 of Exception, plugs, etc. through this editor.
2.3.2 Editing JSP
In the File | New menu, select the JavaServer Page (JSP) under the web tier branch, select JSP Page in the right option, create a JSP called TestdyNaform.
A tool to write Struts Tag is available in JDeveloper, which can be opened in View | Component Palette.
Figure 7
Just check the logo you want to edit, and then drag it into the JSP file and complete a logo. Here is the code of TestdyNaForm.jsp:
<% @ Page language = "java"%>
<% @ Taglib Uri = "/ Web-INF / STRUTS-Bean.tld" prefix = "bean"%>
<% @ Taglib URI = "/ Web-INF / STRUTS-HTML.TLD" prefix = "html"%>
<% @ Taglib URI = "/ Web-INF / STRUTS-LOGIC.TLD" prefix = "logic"%>
hEAD>