jsp Lab
Shared by: stariya
-
Stats
- views:
- 2
- posted:
- 11/19/2011
- language:
- English
- pages:
- 6
Document Sample


1.1 NetBeans and Tomcat
1.1.1 Overview of NetBeans
The NetBeans IDE is a free, open-source Integrated Development Environment (IDE) for Java software
developers. It covers all Java Standard Edition (Java SE), Java Enterprise Edition(Java EE, was called
J2EE before), Java Micro Edition( was called J2ME) all in one IDE environment. This IDE runs on
almost all platforms including Windows, Linux, Solaris, and the Mac OS. It is easy to install and very
convenient to develop any Java based cross-platform desktop, enterprise, Web and mobile applications. It
is also a very useful component-based software development (CBSD) tool to create, reuse, and deploy
Java jar, war, and ear components.
NetBeans provides
Swing GUI Builder , Integrated CVS Version Control, NetBeans Debugger with JUnit,
Developer Collaboration for project sharing in real time, and Ant-based Project System and
Customizable Environment tools;
Source Code Editor for Java SE and JSP Development , XML Editor for DTD, Schema, and CSS,
plus C/C++ Development;
Web server Application Development tools with JSP, Servlets, JavaServer Faces(JSF), and Struts
(Java Enterprise Edition), Sun Application Server, Weblogic, and JBoss ;
RJB developments with ear-jar deployment;
Visual Web Application Development for AJAX, CSS and JSF, Web Service Development
(SOA) with Java Enterprise Edition for WSDL and web services implementation development
and deployment; BEPL design, development, and testing tools;
Web Client Platform Development;
Mobile Application Development (Java Micro Edition) including Connected Limited Device
Configuration (CLDC), CDC, and Mobile Information Device Profile (MIDP); Java ME
Development Cycle Tools;
UML modeling tools with code generators
Embedded Tomcat server
Just like Eclipse, The NetBeans is a popular IDE widely used by Java developers.
1.1.2 Practice lab: using JSP on embedded Tomcat in NetBeans
First, Download the NetBeans from http://www.NetBeanss.org/, the current version is 6.0
After install the NetBeans, you start up NetBeans IDE, and you should see the NetBeans start page as
follows.
Once you installed the NetBeans, the Glassfish v2.1or Tomcat 6.0 can be chosen as the default Server
Steps to Start a Web Project:
Let’s practice the NetBeans IDE with following steps to create a new Web project. In this application
Tomcat 6 is used as the server.
In first step, select File->New Project, and Web->Web Application.
Next, specify the project name and project location in step #2 of “Name and Location”
Skip step #3 Framework selections for the time being.
In the file explorer, select Application name->web->index.jsp, and now let’s do some modification to this
template file.
Copy the following code in the body tag:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Hello User! JSP Page</title>
</head>
<body>
<form name="name" action="index.jsp" method="POST">
<input type="text" name="name" value="" />
<input type="submit" value="submit" name="submit" />
</form>
<%if(request.getParameter("name") != null){%>
Hello, <%=request.getParameter("name")%>
<%}%>
</body>
</html>
Press Run Main Project (F6), The NetBeans will run Tomcat server and you can use browser to visit
localhost to access this JSP file:
If you type in “John” in the text box and then submit the request a new JSP page is generated with the
greeting statement of “Hello John”.
Get documents about "