zoukankan      html  css  js  c++  java
  • 前端的IF语句很实用

    前端的if语句可以用于权限的解决方案

    需求:chebox选择按钮有值传入的时候,显示的是值的数据,没有值或者新建的数据显示页面上的值。

    	<div class="controls">
    			    是
    				<form:radiobutton   path="defaultSelection" name="gender" value="1" htmlEscape="false" style="10px;" maxlength="125" class="required"/>
    			    否<c:if test="${empty ocDevopsScore.defaultSelection}">
    			   <form:radiobutton    path="defaultSelection" name="gender" value="0"  checked="checked" htmlEscape="false" style="10px;" maxlength="125" class="required"/>
    				 </c:if>
    				 <c:if test="${not empty ocDevopsScore.defaultSelection}">
    			   <form:radiobutton    path="defaultSelection" name="gender" value="0" htmlEscape="false" style="10px;" maxlength="125" class="required"/>
    				 </c:if>
    			</div>
    		
    

      

    判断相等执行的语句

     <c:if test="${dict.level == 5}">
      <a href="${ctx}/oc/devopsscore/list?devopsTypeId=${dict.id}">[scoreList]</a>
      </c:if>
    
    可以这样写判断 进行跳框提示
    
    <a href="${ctx}/oc/scope/delete?id=${dict.id}&type=${dict.type}" onclick="return confirmx('Do you want to delete the scope?', this.href)">[delete]</a>
    

      

    需求:判断登录的user是否有权限修改,自己只能修改自己的数据,超级管理院员就能修改全部的数据。

    <c:choose>		
    	    					<c:when test="${fns:getUser().id eq dict.createBy.id}">
    	    					<a href="${ctx}/ito/projectinfo/delete?id=${dict.id}" onclick="return confirm('Do you want to delete the record?', this.href)">[delete]</a>
    	    					</c:when>
    	    					<c:otherwise>
    		    					<shiro:hasAnyRoles name="system">  
    		    					<a href="${ctx}/oc/projectinfo/delete?id=${dict.id}" onclick="return confirm('Do you want to delete the record?', this.href)">[delete]</a>
    		    					</shiro:hasAnyRoles>
    	    					</c:otherwise>
    	    				</c:choose>
    

      

  • 相关阅读:
    mysql中文乱码的一点理解
    Linux 运行进程实时监控pidstat命令
    深入理解“系统平均负载”
    进程和线程的区别
    vmstat命令
    grep命令
    top命令
    Shell脚本获取本机ip
    CentOS7防火墙(firewall)配置
    大数据测试
  • 原文地址:https://www.cnblogs.com/jiajialeps/p/10182602.html
Copyright © 2011-2022 走看看