JSP summary 6: create the first simple JSP page

Source: Internet
Author: User
Tags netbeans

Manually created1. Create a directory named MyApp in the webapps directory of Tomcat 6.0 installation directory. 2. Create a directory WEB-INF under the MyApp directory. Note that the directory name is case sensitive. 3. Create a new file web. xml under the WEB-INF, the content is as follows: <? XML version = "1.0" encoding = "gb2312"?> <Web-app> <display-Name> my web application </display-Name> <description> An application for test. </description> </Web-app> 4. Create a test JSP page under MyApp with the file name "Index. JSP. The file content is as follows: <HTML> <body> <center> now time is: <% = new Java. util. date () %> </center> </body> Create eclipse1. After jdk1.6.0 and tomcat6.0 are installed, copy the eclipse software to a folder on the local hard disk. 2. Install the Eclipse plug-in myeclipse. 3. Run the eclipse.exe file. After opening the file, select the path WINDOW> preferences. The following page is displayed: 4. Select Java> installed jres and click "add: 5. In the "JRE home directory" column, select the installation path of jdk1.6.0 (for example, "C:/jdk1.6.0 _ 02 "), in the JRE name column, enter the ID name (for example, "jdk1.6.0 _ 02 "). After filling in the information, click "OK. 6. Select the path Server> installed runtimes. the pop-up box is as follows: 7. Select Apache Tomcat v6.0 and click "Next". The following dialog box is displayed: Select Tomcat and JDK to use, click "finish" to close the window and exit the preferences window. 8. Select File> New> Project in eclipse to create a new project. Pop-up: 9. Select "Dynamic Web Project", click "Next", enter the project name (such as "test1") as prompted, and click "finish ", project created successfully. 10. In the newly created Project, right-click the "webcontent" folder and choose create JSP file, named "index. jsp ". "Index. in JSP, enter "<center> now time is: <% = new Java. util. date () %> </center> ". 11. Select "servers" in the lower right column of eclipse, and click the green running button with a white triangle in the middle. When "state" of "servers" is displayed as "started", the operation is successful. 12. Enter "http: // localhost: 8080/test1/index. jsp" in the address bar of the browser to view a JSP page showing the time. Netbeans CreationNetbeans6.0 milestone10 is currently the best netbeans Software Series. It has powerful visual development functions, whether for Java swing or JSP. Sun plans to officially release netbeans 6 in November this year. Netbeans 7 was officially released in next November. The visual development of eclipse depends on various plug-ins, and the most powerful plug-in myeclipse is commercial software. The functions of myeclipse and netbeans are similar. Therefore, we recommend that you use netbeans6 because it is open-source and free. it is legal to use it and removes the need to install various Eclipse plug-ins. After netbeans6 is installed, the startup screen is as follows: after the startup is complete, go to the main screen: Select File-> new project menu, select the project category as web, and select Web application. For example, after clicking Next, the following screen is displayed: select the Add button in the server column, and set the tomcat installation directory in the dialog box below. Click next and the following screen is displayed: if you do not select any framework, you only need to create the simplest JSP page. After the project is created, the index. jsp file is displayed. Source code: <% @ page contenttype = "text/html" %> <% @ page pageencoding = "UTF-8" %> <% -- The taglib directive below imports the jstl library. if you uncomment it, you must also add the jstl Library to the project. the add library... actionon libraries node in projects view can be used to add the jstl 1.1 library. -- %> <% -- <% @ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "C" %> -- %> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> <HTML>  

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.