JSP format file is a Dynamic Web page technology standards, is written in the Java Language Dynamic Web page program files, mainly in the process of web site development. However, some people will inadvertently download the process of downloading to JSP format files, such as Jb51. JSP, this situation should be the site has anti-theft chain function reason (meanin
Understanding JSP1. JSP script snippetIn Jsp, java code needs to be nested in Script fragments can be accessed from each other. They can be incomplete, but multiple fragments must be combined into a complete java statement.2. JSP script expressionVariables or expressions in JSP script expressions cannot be followed by
JSP development entry (1) ---- install your machine to use JSP
You will need Java 2 software development tool (jsdk). Its original names are Java Development Tool (JDK), JavaServer website development tool (jswdk), tomcat, or other network servers that support JSP. Sun provides jsdk and jswdk for Windows, Solaris, and Linux for free.
If you want to use
I. Introduction to JSP: Introduction to JSP
JSP stands for Java Server Pages. Like servle technology, JSP is a technology defined by SUN for developing dynamic web resources.
JSP is actually a Servlet.
The biggest feature of JSP
JspThe JSP eventually needs to be converted to Servelt and compiled, and is actually a compiled servlet during the requestJSP specializes in generating a large number of organized pages of structured HTML or other character data. Servlets excel at raw data, build data-rich pages, and perform tasks with little or no output (redirection)1.jsp is converted to servlet and compiled only for the first visit after
This article is the first part of the new JSP Best Practices series, which describes the JavaServer Pages include mechanism. Follow the Java programming expert Brett McLaughlin Learn how to use include to add static header and footer files to your Web site or Web application page.
Welcome to the latest best practices series in the Java area. If you've seen a series of previous articles, you'll know that best practices are designed to give you a quick
Code that previously interacted with the servlet and JSP
Example of a servlet code:
JSP code example:
What if the property is not a string but a bean?
A simple javabean.
Example of a servlet code:
JSP code example:or write this:
Do not appear in the JSP script
One, custom Tags: Java classes that implement a specific interface encapsulate the predefined behavior written by Java code.
* At run time, the label is replaced with the corresponding predefined Java code.
* JSP Custom tags provide a way to replace simple JavaBean and Java scripts.Better yet, there is already a set of defined standard custom tag libraries in JSTL.
* The purpose is to separate the business from the presentation logic, the reusability
SP Notes instruction Element the directive element is used to specify information about the Web page itself. For example: The instruction element begins with the other attributes of the page directive and Errorpage,iserrorpage,session,pageencoding,buffer,autoflush, Language,import property. Other instruction elements and . Taglib need to explain the following example: %> The URI represents the Jstl library provided by Sun. The value of the prefix represents the l
For all of the data required by all users, and do not have to read from the database every time, only the first time to read out to memory, then create a new servlet, delete the servlet mappings all users can not access, so need to add configuration to the servletIndicates that the service is started and initializedInitialization of data in Servlet init method (Doget dopost set NULL)Foreground output CodeFor changes in the data needs to be synchronized can be modified when the completion of sync
statement object: PreparedStatement if (prestmt!= null) {try{ Prestmt.closE ();
prestmt = null;
}catch (Exception ex) {ex.printstacktrace (); }
}
}
}
Show single Item Detail page
It's not hard to see that the index.jsp and single pages are the same head and tail, so we can optimize the code with the include instructions in the 3 compiler directives (page, include, and taglib) of the JSP.Using the include directive, you can embed an external file into the cu
Although you can put a large chunk of program code in a small instruction file, most Java program code belongs to reusable components called JavaBean. JavaBean are like ActiveX controls: They provide known functionality and are designed to be reusable for any purpose.
The value of JavaBean is that it can be used through a set of features that provide access to JavaBean settings. As an example, the person is JavaBean, and his name, social security number, and address can be characteristic. For
js| Note 1. This example basically tells us how to call the JavaBean widget in JSP code
2. The advantage of using JavaBean is to simplify the JSP code, the interface code and the logical code are separated from each other, easy for the programmer to view and debug
3. This example requires five documents: login.jsp,test.jsp, Userbean.class
4. First look at the login.jsp
<html><center><form method=post action
JS in the previous tutorial, we have used the java.util.Date. One can ask: Why not use import java.util.*? In fact, the import statement can also be used in JSPs, but its syntax is somewhat different from that of normal Java. An example is given below:
<%@ page import="java.util.*" %> <HTML> <BODY> <% System.out.println( "Evaluating date now" ); Date date = new Date(); %> Hello! The time is now <%= date %> </BODY> </HTML> The first line in the above code we call a "directive". This
Tags: style color SP Java data Code as database CJSP page: JS method nested Java code (is the operation of the database), if the JS method is not called, when the JSP page is parsed, regardless of whether the JS method is called this Java code will be executed? because the most recent parsing is the Java code, no matter where it is written, will be the latest parsingJSP page: JS method nested Java code (is the operation of the database), if the JS met
1. JSP directives:(1). page directive: Usually at the top of a JSP page, the same page can have multiple page directivesSyntax: Common Properties:Language: Specifies the scripting language used by the JSP page; default value: JavaImport: Use this property to refer to the class file used in the scripting language; Default value: NoneContentType: Used to specify th
JSP page file consists of JSP elements and template data!The following is a simple JSP file program code:1 @ Page Language="Java"ContentType="text/html;2 CharSet=UTF-8"3 pageencoding="UTF-8"%>4 DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">5 HTML>6 Head>7 Metahttp-equiv= "Content-type"content= "text/html; cha
First, let's talk about why it should be static.For the current web application, dynamic pages have a very high position. It is because of the dynamic nature that the current web is rich and colorful, but just like all other facts, the benefits are often at a cost.To produce dynamic results, each page request requires the server to compile or execute the page. These operations consume system resources. If there is still communication with the database during this period, the cost will be even gr
Document directory
2.4.1 open myeclipse
2.4.2 configure Tomcat path
1 JSP function sp can put Java code and HTML code in one file, which is a good way to develop dynamic websites.
2 install and configure myeclipse, JDK, and tomcat
Myeclipse allows you to conveniently manage web projects and easily integrate Tomcat for JSP debugging. As an extension of Eclipse, myeclipse can implement various functions
Basic jsp development knowledge and basic jsp knowledge
1. JSP Definition
JSP stands for Java Server Pages. It is a technology defined by SUN for developing dynamic web resources.Its implementation is to embed java code in our html code. The jsp file extension is. jsp.Feat
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.