JSP Learning Notes (i)

Source: Internet
Author: User

Comments:

1. Single-line Comment <!----> or//

1 <%@ Page Language="Java"Import="java.util.*"ContentType="text/html, Utf-8 ""%>2 3 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en">4 <HTML>5   <Head>6     <Basehref= "<%=basePath%>">7     8     <title>My JSP ' helloworld.jsp ' starting page</title>9     Ten     <Metahttp-equiv= "Pragma"content= "No-cache"> One     <Metahttp-equiv= "Cache-control"content= "No-cache"> A     <Metahttp-equiv= "Expires"content= "0">     -     <Metahttp-equiv= "keywords"content= "Keyword1,keyword2,keyword3"> -     <Metahttp-equiv= "description"content= "This is my page"> the     <!-- - <link rel= "stylesheet" type= "Text/css " href= "Styles.css" > -      - -     <title> + Hello,world -     </title> +   </Head> A    at   <Body> -   <!--Print Hello world - -      <% - Out.print ("hello,world!"); -       %> -   </Body> in </HTML>

2. Multiline comment <%%>

1<%@ page language= "Java"Import= "java.util.*" contenttype= "text/html; Utf-8 ""%>2 3<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >456<base href= "<%=basePath%>" >7     8<title>my JSP ' helloworld.jsp ' starting page</title>9     Ten<meta http-equiv= "Pragma" content= "No-cache" > One<meta http-equiv= "Cache-control" content= "No-cache" > A<meta http-equiv= "Expires" content= "0" > -<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" > -<meta http-equiv= "description" content= "This is my page" > the<!-- -<link rel= "stylesheet" type= "Text/css" href= "Styles.css" > -- -<title> + Hello,world -</title> + A    at<body> -<%-- - Print -hello,world! ---%> -<% inOut.print ("hello,world!"); -%> to</body> +

JSP scripting elements

1.JSP Declaration <%! %>

2.JSP expression <%=%>

3.JSP scriptlets<%%>

1 <%@ Page Language="Java"Import="java.util.*"ContentType="text/html; Utf-8"%>2 3 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en">4 <HTML>5   <Head>6     7     <title>My JSP ' helloworld.jsp ' starting page</title>8     9     <Metahttp-equiv= "Pragma"content= "No-cache">Ten     <Metahttp-equiv= "Cache-control"content= "No-cache"> One     <Metahttp-equiv= "Expires"content= "0">     A     <Metahttp-equiv= "keywords"content= "Keyword1,keyword2,keyword3"> -     <Metahttp-equiv= "description"content= "This is my page"> -     <!-- the <link rel= "stylesheet" type= "Text/css " href= "Styles.css" > -      - -     <title> - JSP scripting elements +     </title> -   </Head> +    A   <Body> at     <%!  -         intNUM1=1; -         intnum2=2;  -         intnum3; -         intAdd (intNUM1,intnum2) -         { in return NUM1+num2; -         } to     %> +     <% - num3=NUM1+num2; the     %> *Num1+num2=<%=Add (num1,num2)%> $      <BR>Panax Notoginsengnum3=<%out.println (num3);%> -   </Body> the </HTML>

JSP Learning Notes (i)

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.