【正文】
tProperty JSP: name attribute namely for JSP: useBean defined in the Bean id, its property attribute specified is the target attribute names. Facts prove that Java Servlet is one kind of development the Web application ideal framework. The JSP with Servlet technology as the foundation, and in many ways improved. The JSP page looks like ordinary HTML pages, but allows embedded code execution, at this point, it and the ASP technology are very similar. Using crossplatform running JavaBean ponents, JSP for separation treatments logic and display provides excellent solutions. The JSP will bee the ASP technology contender. JSP 基礎(chǔ)學(xué)習(xí)資料 一、 JSP 技術(shù)概述 在 Sun 正式發(fā)布 JSP(JavaServer Pages) 之后,這種新的 Web 應(yīng)用開(kāi)發(fā)技術(shù)很快引起了人們的關(guān)注。 % Method of use 1: p product: %= () % br Tax rates: %= () % p % (A003)。 } } In applying the above JSP page Bean will use markup. UseBean JSP: Depend o n specific use JSP engine is different, where configuration, and how to configure Bean approach can be slightly different. This paper will the Bean, scaleup files in c: JSWDK examplesWEB INFjspeans ax directory, here is a special store the tax Bean directory. Below is an example of applying the above Bean page: HTML BODY % page language=java % jsp:useBean id=taxbean scope=application class= / % (A002)。 } public void setRate (double rateValue) { = rateValue。 } public void setProduct (String ProductName) { = ProductName。 public TaxRate() { = A001。 public class TaxRate { String Product。 String name = (String) (thename)。a results. It from the value of the thename session object extraction and display it, prove the value in the first though page input, but through session object is maintained. Percentile. JSP another task is to extract the user input at the second page and displays it: HTML BODY % page language=java % %! String food=。 (thename, name)。 % defines a String variable. In every statement behind must have a semicolon, just like in ordinary Java class declaration in the same member variables. Located in % and % between the code block is to describe the JSP page handling logic of Java code, such as the example shown the seas cycle. Finally, located in % = and % between code is called the JSP expression, such as the example of % = STR % below. The JSP expression provides a will JSP generated numerical embedded HTML pages of simple method. 2. The session state management The session state maintain is the Web application developers must face the problem. There are various ways can be used to solve this problem, if use Cookies, hidden form input domain, or directly to the URL in additional status information. Java Servlet provides a continuous effectively in multiple requests the conversation between objects, the object allows users to store and retrieve the session state information. The JSP also support Servlet of this concept. In the JSP from guidelines can see many relevant implied object instructions (implicit meaning is that these objects can directly referenced, do not need explicit statement, also do not need special code to create actually cases). For example that object, it is the HttpServletRequest a derived class. The object contains all the related current browser requests information, including Cookies, HTML form variables, etc. Session object is also such a hidden objects. This object in the first JSP page is loaded, and automatically created by related to that objects. The conversation with ASP object of similar, JSP session object for those who hope that through multiple pages to plete a affairs application is very useful. To illustrate the session object concrete application, next we use three pages more than a page of simulation Web application. The first page (q1. HTML) contain only a requirement to enter your user name HTML forms, the HTML code is as follows: HTML BODY FORM METHOD=POST ACTION= Please write your name: INPUT TYPE=TEXT NAME=thename INPUT TYPE=SUBMIT VALUE=SUBMIT /FORM /BODY /HTML The second page is a JSP page (q2. JSP), it through that object extraction in q1. HTML form thename value, it will be stored for name variable, then will the name value saved to the session objects. Session object is a name/value pairs set, here, name/value pairs of the name is thename, namely for name values of the value of the variable. Due in session during the session object is effective until, so here preserved variables on subsequent page as well. Q2. JSP another task is to ask the second question. Below is its code: HTML BODY % page language=java % %! String name=。 P %= str % P JSP After out。 i++) { str = str + i。 % % for (int i=1。s ability. In ASP and JSP environment, HTML code is mainly responsible for describe information display, and program code is used to describe handling logic. Normal HTML page only depends on the Web server and the ASP and JSP page need additional language engine analysis and implementation program code. The program code to be executing embedded into HTML code, then the message to all browsers. ASP and JSP are facing the Web server technology, the client browser does not need any additional software support. ASP programming language is VBScript such scripting language, JSP use is Java, this is both one of the most significant differences. In addition, ASP and JSP more essential difference: two languages in a totally different way engine handling page embedded program code. In the ASP, VBScript code is ASP engines interpret execution。 8) Struts :基于 MVC 的一個(gè)輕量級(jí)框架