Illustration] jdk1 [1]. 6 _ + _ myeclipse_7.0 _ + _ tomcat-5.5 _ configure the JSP Environment

Source: Internet
Author: User

Software to be prepared before installation:

1. jdk-1.6

2. tomcat-5.5.28

3. myeclipse 7.0

If you have installed the JDK environment, you only need to install Tomcat.
The software is as follows:
Jdk-1.6 --: http://java.sun.com/javase/downloads/index.jsp
Tomcat-5.5.28 --: http://apache.etoak.com/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.zip
1. Install the JDK Environment

JDK-1.6 installation, we use the EXE version of the installation file, in addition to the Select Directory, other are good by default, Here installed to D: \ tomcat5.5, pay attention to the middle of the Space removed, it is troublesome to have spaces.

Jdk-1.6 installation diagram similar to link: http://user.qzone.qq.com/529901956/blog/1270804791
Ii. install Tomcat
For tomcat installation, we use the installation file of the EXE version. Except for the Directory selected, all other files are installed by default. Here we install them to D: \ tomcat5.5. Note that the space in the middle is removed, it is troublesome to have spaces.
Tomcat-5.5.28 installation diagram link: http://user.qzone.qq.com/529901956/blog/1270043200
3. install and configure myeclipse to run JSP
1. First install Java jdk1.6 and tomcat-5.5.28 at the specified location and test successfully.
2. install myeclipse7.0 (which is usually installed by default). myeclipse is an EXE installation file. You can directly double-click the Installation Wizard and select the myeclipse7.0 installation directory and its own installation directory, next is all the way. Enter the registration code of myeclipse, open the menu window-> preferences, open myeclipse-> subferences in the menu tree of the dialog box, click Enter subferences... Enter the user name and password.
3. Configure myeclipse7.0
Run myeclipse7.0.exe. The update will also be detected. Confirm, and then restart myeclipse7.0.exe.
1) Add JDK path
Menu (main menu)-> window (window)-> references (preferences)-> JAVA-> installed jres
(Installed JRE), click Add ).

Browse JDK path, click OK

2) Set Server
On the menu bar, choose Window> preference> myeclipse "--
"Servers" -- "Tomcat" -- tomcat5.x
Set Tomcat server to enable and tomcat home directory to Tomcat
Other DIRECTORY options will be automatically generated.

Next, select tomcat5.x -- JDK and select the JDK added before Tomcat JDK name.

3) configure the default encoding
Still "window" in the menu bar -- "preference" -- "general )"--
"Content types" -- "text )".
Enter UTF-8 in default encoding and click Update to add the Java class file
(Java properties file) and other character encodings are "updated" as "UTF-8 ".

6. Create a project
Main Menu-> file-> New-> Web project

1) Right-click SRC -- New -- package (COM. Alibaba resky. Bean)

2) Right-click the package -- New -- Java class (Hello) and note that the public static void main option is removed. All others are default. Click Finish to create the class.
Edit the code of the hello. Java class as follows:
Package com. Alibaba resky. Bean;
Public class Hello {
Private string message = "Hello World ";
Public String getmessage (){
Return message;
}

Public void setmessage (string message ){
This. Message = message;
}
}
Note that the bean attribute operation method can define the attributes first. Then, right-click the edit window and choose source> Generate getters and setters, in the dialog box, select the property of the get and set methods to be generated to confirm.

3) Right-click webroot -- New -- JSP (index. jsp)
Edit the index. jsp file as follows:
<% @ Page Language = "Java" Import = "Java. util. *" pageencoding = "UTF-8" %>
<%
String Path = request. getcontextpath ();
String basepath = request. getscheme () + ": //" + request. getservername () + ":" + request. getserverport () + path + "/";
%>
<JSP: usebean id = "hello" class = "com. Alibaba resky. Bean. Hello" Scope = "page"/>
<JSP: setproperty name = "hello" property = "message" value = "Hello world! "/>
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
<HTML>
<Head>
<Base href = "<% = basepath %>">
<Title> my JSP 'index. jsp 'starting page </title>
<Meta http-equiv = "Pragma" content = "no-Cache">
<Meta http-equiv = "cache-control" content = "no-Cache">
<Meta http-equiv = "expires" content = "0">
<Meta http-equiv = "keywords" content = "keyword1, keyword2, keyword3">
<Meta http-equiv = "Description" content = "this is my page">
<! --
<LINK rel = "stylesheet" type = "text/CSS" href = "styles.css">
-->
</Head>
<Body>
<JSP: getproperty name = "hello" property = "message"/> <br>
This is my JSP page. <br>
</Body>
</Html>

Release settings
Right-click the project name -- myelipse -- add and remove project deployments, and click Add

Select tomcat6.x in the server.

Click tomcat6.x and click "Redeploy" to release the project. The project will be updated and released here.

Start Web Services

View running results

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.