JAVA step-by-step WEB programming about JSP and JavaBean

Source: Internet
Author: User

 

 
   
Java WEB applications include SERVLET, JSP, XML, etc. Using SERVLET to write CGI programs to implement request and response services, it is a small application on the server side. JSP is easier to develop than SERVLET, but it will eventually be converted into SERVLET. JSP combines HTML (or XML) to generate many SCRIPT tags, and encapsulates data in the tags of these definitions, attribute, embedded in JAVA program segments, expressions, and some behavior roles are also defined to combine with JAVABEAN to create a more simplified and intuitive programming direction, as a servlet api extension, all the advantages and features of JSP are more conducive to the development and application of WEB containers. As a JAVA component technology, JAVABEAN is used in JSP applications to set and call data to dynamically generate content.
As an application implementation, it focuses on understanding. Therefore, we only configure JAVA and JAVABEAN for running instances as follows. First, as a JAVA programmer, for jsp web programming application development, you have
A little understanding and understanding,<% --- %> Mainly contains code snippets and expressions <%! -- %> Define variables and methods <% =%> Output. when using JAVABEAN, JSP has the following tag: <JSP: USEBEAN> and the tag <JSP: SETPROPERTY> and <JSP: GETPROPERTY & g are used in the following example.
First, download JDK from the home page of SUN. Here we download JDK 1.3, which is installed in C: JDK1.3, and then TOMCAT. There are many places to download, here is the version downloaded on the http://jakarta.apache.org Manager Web site for the jakarta-tomcat-3.3a installed and placed in C: The jakarta-tomcat-3.3a mainly sets AUTOEXEC in WINDOWS. add the following two items to the BAT batch file:
Set java_home = c: jdk1.3
Set tomcat_home = C: jakarta-tomcat-3.3a

This can be said to be a simpleEven if the WEB server supports the JSP and SERVLET runtime environments, you must first test whether the HTTP service can be run.
First go to the C: jakarta-tomcat-3.3ain Directory Double-click startup in this MS-DOS if out of environment space appears, it doesn't matter you just click the properties OF the window, in the memory column the initial ENVIRONMENT is set to 2816, now, two windows will be successfully displayed when you run STARTUP. Open the browser and enter HTTP: // LOCALHOST: 8080, the main page of TOMCAT appears in front of us. Write your own JSP program.
"Mysjp. jsp"
<Html>
<Body>
<% = New java. util. Date () %>
<% = New java. lang. String ("hello my jsp") %>
<% For (int I = 0; I <10; I ++ ){
Out. print ("hellojsp" + I + "<br> ");}
%>
<% String s = "hello jsp world"; %>
<% = S %>
<%! String d; %>
<% D = "hello jsp my world"; %>
<% = D %>
</Html>
</Body>
As a test we put it under the C: jakarta-tomcat-3.3awebappsROOT directory,
URL input: http: // localhost: 8080/myjsp. jsp
For configuration of TOMCAT server, please refer to other materials. Here we will use a brief description
The directory structure of tomcat is as follows:
Application

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.