【JSTL】判斷Session中的值是否為空白

來源:互聯網
上載者:User

標籤:jstl   jsp   

[html] view plaincopyprint?
  1. <span style="white-space:pre"></span><span style="white-space:pre">                           </span><c:if test="${sessionScope.errorcode!=null}">  
  2. <span style="white-space:pre">                                </span><c:if test="${sessionScope.errorcode==0}">  
  3. <span style="white-space:pre">                                </span>pswd error.  
  4. <span style="white-space:pre">                                </span></c:if>  
  5. <span style="white-space:pre">                            </span></c:if>  

初學JSTL,主要用途是為了代替前端的JSP代碼,令其全部為HTML標籤顯得美觀一些。。。

還是很簡單的,首先sessionScope擷取域,然後判斷其中errorcode是否為空白,我這裡判斷的是使用者登入資訊是否正確,通過Servlet的時候如果使用者資訊錯誤的話就會在session中放一個errorcode,然後到前端判斷這個errorcode的值為多少,並根據值的大小來顯示相關的資料

這兒判斷如果值為0表示使用者密碼錯誤。。

【JSTL】判斷Session中的值是否為空白

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.