MyEclipse Environment Configuration
First, install a myeclipse and then do some related environment configuration (window->preferences):
such as fonts, formatter and so on.
You can also export the configuration from Eclipse and import it in MyEclipse.
There are two configurations that require special attention:
How to open 1.JSP:
Select to open with editor:
Window->preferences->general->file Associations
Then select the JSP in the right window, choose MyEclipse jsp Editor below, and press the default button on the right to select it.
2. Choice of encoding format
Because the default format does not support Chinese, you need to change the default format to UTF-8, so that you do not have to support each modification in Chinese.
In Window->preferences search JSP, on the left point JSP, find the encoding settings, set to UTF-8:
New program
Create a new Web program,file->new->web Project.
From a named Helloweb, then choose 6.0, point to finish:
The project was then completed:
Open index.jsp, you can modify the inside of the body.
For example, my index.jsp:
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%><%string path = Request.getcontextpath (); String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Access via Tomcat serverTo access this page through a browser, you need to configure the relevant path in Tomcat:
Find the conf directory for Tomcat and have a file called Server.xml .
Use the editor to open the file, pull to the end, and add this line before the host tag ends:
<context path= "/helloweb" docbase= "E:\MDD\MyEclipseWorkspace\HelloWeb\WebRoot" reloadable= "true"/>
Note the Context first letter capitalized.
The Path property value is required to access the page, followed by the first pathname after the server port number, where the \ Plus project name (with a different name) is used. Slashes cannot be less.
The name to be given here corresponds to the address visited in the browser (see the path name after port number 8080 below).
docBase The Webroot path of the property value item.
The complete server.xml looks like this:
<?xml version= ' 1.0 ' encoding= ' utf-8 '?><!--Licensed to the Apache software Foundation (ASF) under one or more C Ontributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); You are not a use of this file except in compliance with the License. Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable or agreed to writing, software distributed under the License are distributed on a "as is" BASIS, without warranties or CONDITIONS of any KIND, either express or implied. See the License for the specific language governing permissions and limitations under the license.--><!--note:a ' Server ' is not itself a ' Container ', so that you are not define subcomponents such as ' valves ' at the this level. Documentation At/docs/config/server.html--> <server port= "8005" shutdown= "Shutdown" > <!--Security listener. Documentation at/docs/config/listeners.html <listener classname= "Org.apache.catalina.security.SecurityListener "/>-<!--APR Library loader. Documentation At/docs/apr.html--<listener classname= "Org.apache.catalina.core.AprLifecycleListener" Sslengine= "on"/> <!--Initialize Jasper prior to WebApps is loaded. Documentation At/docs/jasper-howto.html--<listener classname= "Org.apache.catalina.core.JasperListener"/ > <!--Prevent memory leaks due to use of particular Java/javax apis--> <listener classname= "Org.apache.cata Lina.core.JreMemoryLeakPreventionListener "/> <listener classname=" Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener "/> <listener classname=" Org.apache.catalina.core.ThreadLocalLeakPreventionListener "/> <!--Global JNDI Resources Documentation at/d Ocs/jndi-resources-howto.html-<globalnamingresources> <!--Editable User database that can also is used by Userdatabaserealm to authenticate users --<resource name= "Userdatabase" auth= "Container" type= "Org.apache.catalina.UserDatabase" description= "User database that can be updated and saved" factory= "Org.apache.catalina.users.MemoryUs Erdatabasefactory "pathname=" Conf/tomcat-users.xml "/> </GlobalNamingResources> <!--A" Service "is a collection of one or more" connectors "that share a single" Container "Note:a" Service "was not itself a" Co Ntainer ", so-define subcomponents such as" valves "at the This level. Documentation at/docs/config/service.html-<service name= "Catalina" > <!--the connectors can use a sh Ared executor, you can define one or more named thread pools--> <!--<executor name= "Tomcatthreadpool" name prefix= "catalina-exec-" maxthreads= "Minspare"threads= "4"/>-<!--A "Connector" represents an endpoint by which requests is received and RESP Onses is returned. Documentation At:java HTTP Connector:/docs/config/http.html (Blocking & non-blocking) Java AJP Con Nector:/docs/config/ajp.html APR (HTTP/AJP) Connector:/docs/apr.html Define a Non-ssl http/1.1 Connector On port 8080--<connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/> <!--A "Connector" using the shared thread pool--> <!--<connector exe Cutor= "Tomcatthreadpool" port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>-<!--Define a SSL http/1.1 Connector on port 8443 this Connector uses The JSSE configuration, when using APR, the connector should is using the OpenSSL style configuration des CribEd in the APR documentation-<!--<connector port= "8443" protocol= "http/1.1" sslenabled= "true" maxthreads= "Scheme=" "https" secure= "true" Clientauth= "false" sslprotocol= "TLS"/>--& lt;! --Define an AJP 1.3 Connector on port 8009--<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/&G T <!--an Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes T Hem on to the appropriate host (virtual host). Documentation At/docs/config/engine.html-<!--should set Jvmroute to support load-balancing via AJP ie: <engine name= "Catalina" defaulthost= "localhost" jvmroute= "jvm1" >-<engine name= "Catalina" default host= "localhost" > <!--for clustering, click a look at the documentation at: /docs/cluster-howto.html/docs/config/cluster.html (reference documentation)--&L t;! --<cluster classname= "Org.apache.catalina.ha.tcp.SimpleTcpCluster"/>-<!--use the LOCKOUTR Ealm to prevent attempts to guess user passwords via a brute-force attack--<realm classname= "org.a Pache.catalina.realm.LockOutRealm > <!--This realm uses the userdatabase configured in the global JNDI Resources under the key "Userdatabase". Any edits that is performed against this userdatabase is immediately available for use by the Re Alm. --<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "userdatabase"/ > </Realm> After saving, run the startup.bat batch program under Tomcat's Bin directory to start the server.
After the server starts, enter in the address bar of the browser: http://localhost:8080/HelloWeb/index.jsp
You can see your own page, as follows:
Developing the first Web program using MyEclipse