JSP notes -1

xiaoxiao2021-03-06  98

1. In JSP, you can use a relative path to replace the absolute path, "/Test1.jsp"à is the root directory of the web application containing this JSP file.

2. If you want to enter "%>" between <%%>:

<% int 1; "% /> in JSP");%> This can avoid misunderstanding!

3. Similarly, if you want to display "<%", you should use "<%" to replace "<%", and it will not be misunderstood as the beginning of the mentoring element.

4. The current content is started with quotation marks, and the rules that avoid conflicts are as follows: "'" is replaced "/'"; "" "is replaced" / ""; for example: <% int 1; OUT. Println ("I /" Love / "Your");%>

5. Output system time:

system time <% = (new java.util.date ()). Tolocalestring ()%>

6. Note <1> HTML Note: Show <2> in the client HTML source code: Do not send it to customers <% - Comment -%>

7. Declaration JSP grammar: <%! Declaration ...%> Note: The statement must be ";" ending; a statement is only valid in a page, if you want each page to use some statements, it is best to write them into one Separate files, then use <% @ include%> or element.

8. Convert into strings: * .tostring (); Character and digital conversion: string max = rst1.getstring (1) .trim ();

INT ID = Integer.Parseint (max) 1;

String maxid = ID ""

9. Judgment character equal: String Temp; if (Temp.Equals ("Hello")) {...} or IF (Temp.EqulsignoreCase ("Hello") {...} / * ignore the case

10. OUT object Scriplet block

转载请注明原文地址:https://www.9cbs.com/read-96792.html

New Post(0)