==MyEclispse Installation
1. MyEclipse is a commercial plugin for Eclipse
2. Current version of MyEclipse includes Eclipse installation
==Creating and Publishing WebProject in MyEclipse
1. Create a Java Web Project
a) it automatically creates the following in the web project dir
META-INF/
WEB-INF/web.xml
hello.jsp
2. Publish WebProject
a) Manual, just as in last post
b) Auto, Let MyEclipse copy your file into Tomcat's webapps dir
b.1 Set Tomcat dir: Perference->MyEclipse->Application Servers->Tomcat->tomcat<version>
b.2 Set JDK path: Perference->...->Tomcat->tomcat<version>->JDK: Add JDK
b.3 Toolbar: Manage deploy: Select Tomcat<version>
==The first interactive web
input.htm
<html>
<head>
<title> Input </title>
</head>
<body>
<form method="post" action="input.jsp" onSubmit="validate(this)">
Input: <input type="text" name="info">
<input type="submit">
</form>
</body>
</html>
input.jsp
<%
String str = request.getParameter("info");
out.println(str);
%>
input.htm with Javascript to check the input not being blank
<html>
<head>
<title> Input </title>
</head>
<script language="javaScript">
function validate(f) {
if(/^\s*$/.test(f.info.value)){
alert("Input could not be empty");
f.info.focus();
return false;
}else{
return true;
}
}
</script>
<body>
<form method="post" action="input.jsp" onSubmit="validate(this)">
Input: <input type="text" name="info">
<input type="submit">
</form>
</body>
</html>
没有评论:
发表评论