zoukankan      html  css  js  c++  java
  • JAVA-JSP注释

    相关资料:

    《21天学通Java Web开发》

    结果总结:

    1.一类可以在客户端显示的注释,即HTML注释。
    2.<!-- -->,中间为注释部分。
    3.如果使用MyEclipse编写JSP,提示无法保存,需要增加一行“<%@ page pageEncoding="gb2312"%>”

     1 <%@ page pageEncoding="gb2312"%>
     2 <html>
     3 <head>
     4   <title>commentsdemo</title>
     5 </head>
     6 <boby>
     7   <!-- 声明变量a -->
     8   <%! int a=1; %>
     9   <% 
    10     out.println("a="+a);
    11   %>
    12 </body>
    13 </html>
    View Code

    结果总结:

    1.一类是不能在客户端显示的注释,即JSP注释。
    2.<%-- --%>,中间为注释部分。
    3.如果使用MyEclipse编写JSP,提示无法保存,需要增加一行“<%@ page pageEncoding="gb2312"%>” 

     1 <%@ page pageEncoding="gb2312"%>
     2 <html>
     3 <head>
     4   <title>commentsdemo2</title>
     5 </head>
     6 <body>
     7   <%-- 声明变量a --%>
     8   <%! int a= 1; %>
     9   <%-- 在网页上打印出变量a的值 --%>
    10   <%
    11     out.println("a= "+a);
    12   %>
    13 </body>
    14 </html>
    View Code

    4.在JSP脚本元素中使用java注释“//”,同样不会在html源代码中显示。

     1 <%@ page pageEncoding="gb2312"%>
     2 <html>
     3 <head>
     4   <title>commentsdemo3</title>
     5 </head>
     6 <body>
     7   <%! int a=1; //声明变量a%>
     8   <%
     9     out.println("a= "+a);
    10   %>
    11 </body>
    12 </html>
    View Code
  • 相关阅读:
    日记
    没有起得晚的周末,希望今天能做一些什么
    怎么就这么喜欢测软件呢?—— Google Calendar农历问题
    Sharepoint带自定义属性的FieldType
    自己使用Outlook 2003 的一些小技巧
    Xml名称空间
    c# jingtailei 静态成员
    select count
    varchar nvarchar(转)
    linq 笔记(1)
  • 原文地址:https://www.cnblogs.com/FKdelphi/p/7402772.html
Copyright © 2011-2022 走看看