Struts study notes 1

xiaoxiao2021-03-05  46

First, the environment is built

a) JDK: Some tools are running on this platform, and some tools come with JDK.

http://java.sun.com/j2se/1.4.2/download.html

b) Eclipse: Java's IDE development tool.

http://www.eclipse.org

c) Struts: Struts Development Kit.

http://struts.apache.org/

d) Tomcat: web server for testing, publishing a web application.

http://jakarta.apache.org/tomcat/index.html

e) ANT: Based on Java build tool.

http://ant.apache.org/

f) Several commonly used Eclipse plugins:

Lomboz, Xmlbuddy, Checkstyle, Tomcat, EMF-SDO-Runtime

Second, the configuration development environment

a) Set an environment variable

Java_Home, Tomcat_Home, Ant_home

Add% java_home% / bin,% Tomcat_Home% / bin,% ant_home% / bin

b) Configure the Lomboz plugin

Set the "JKD Tools.jar:", "Server Definitions" option for the Lomboz plugin

c) Configure Tomcat plugin

Set the Tomcat Version, "Tomcat Home", "Tomcat Home" option of Tomcat plugin, "JVM Settings" option

The JRE specified in "JVM Settings" must be the path to JDK.

Third, test development environment

a) New Lomboz J2EE Project project, named TEST

b) Next, next step

c) Add MODULE in Web Modules, namely Mytest

d) Select Add a web server in TargeTed Servers, here chooses Apache Tomcat V5.0.x

e) Add a Source Folder after completion, name to SRC

f) Set the output path of the TEST project to test / mytest / web-inf / classes

g) Open Lomboz J2EE View, Deploy MyTest

h) Start Tomcat, open the browser to enter http: // localhost: 8080 / mytest

i) Show welcome

Four, Based on Struts HelloWorld

a) Copy the * .jar file under the STRUTS development kit lib directory to the test / mytest / web-inf / lib directory

b) Copy the * .dtd, *. TLD, * .xml file under the STRUTS development kit lib directory to TEST / MyTest / Web-INF / Directory

c) Right click on MyTest, select the add-web-inf / lib jars to classpath option in Lomboz J2EE.

d) Edit Web.xml file, add code:

Action

Org.apache.struts.Action.ActionServlet

config

/Web-inf/struts-config.xml

1

Action

*. do

e) New struts-config.xml file, add code:

PATH = "/ my"

Forward = "/ helloworld.jsp" />

ContentType = "text / html" />

f) New HelloWorld.JSP file, enter helloworld and so on in Body

g) Re-deploy mytest

h) Open the browser to enter http: // localhost: 8080 / mytest / my.do

i) Show HelloWorld and other content

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

New Post(0)