JSP :運行最簡單的 JSP 程式

來源:互聯網
上載者:User

標籤:

 

 

160916

1. 代碼和顯示效果

 

 1 <%@ page contentType="text/html; charset=GB2312" %> 2 <%@ page import="java.util.Date" %> 3  4 <%! 5         Date date; 6         int sum; 7         public int getFactorSum(int n){ 8             for(int i=1; i<n; i++){ 9                 if(n%i==0)10                     sum=sum+i;11             }12             return sum;13         }14 %>15     16 <HTML>17     <BODY bgcolor = cyan>18         <FONT Size = 4>19         <P>程式片建立Date對象:6699999920             <%    date = new Date();                        21                 out.println("<br>" + date + "<br>");22                 int m = 100;23             %>24             <%=m%>    的因子之和是(不包括<%=m %>)25             <%=getFactorSum(m)%>26         27         </p>28         </FONT>29     </BODY>30 </HTML>

 

 

 

 

2. 體會是:jsp程式,html,xml 都注意了,別像java那樣習慣性加空格了,緊一點好

 

      160916

JSP :運行最簡單的 JSP 程式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.