java前端常见报错整理

1.checkbox标签已有checked=checked但是不显示勾选

 1 页面:
 2 <div class="col-sm-1">
 3      <label class="radio-inline">  <input type="radio" id="rdo1" name="optionsRadiosinline"  value="yes" > 4         </label> 
 5        </div>
 6        <div class="col-sm-1">
 7         <label class="radio-inline"><input type="radio" id="rdo2" name="optionsRadiosinline" value="no" > 8         </label>
 9     </div> 
10 <script type="text/javascript">
11 if('no' == data[17]){
12     $("input[name='optionsRadiosinline']:checked").removeAttr("checked");
13     $("#rdo2").attr("checked",true);
14 }
15 </script>

 

原因:这好像是本身attr存在的问题

解决方案:添加的时候用prop,取消用removeAttr。

  $("input[name='optionsRadiosinline']:checked").removeAttr("checked");

  $("#rdo2").prop("checked",true);

 

2. 值的获取 cannot be resolved to a variable

//在页面中引用Java类方法:
<head>
<%@ page language="java" import="kklazy.security.support.encrypt.utils.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" buffer="512kb" %>
 </head>

<script type="text/javascript">
var ceoId =  data[50];
if("" !=ceoId && null != ceoId){
    $("#ceoId").val(<%=EncryptUtils.decode(ceoId) %>);
}
</script >            

报错:ceoId cannot be resolved to a variable;

原因:在java代码中引入js中的变量,这个是不行的..
反过来如果你要在js中引入java变量,这个还是可以。

原理是:java代码在服务器端先执行,你在java代码块里没有定义ceoId,所以编译器肯定报错了。

3.org.apache.jasper.JasperException: /webpages/../../search.jsp (line: 296, column: 6) "${entity.status not eq '00' }" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${entity.status not eq '00' }]

------>not eq 改成--》ne

eq相等 ne、neq不相等,
gt大于, lt小于
gt大于, lt小于
gte、ge大于等于  
lte、le 小于等于  
not非   mod求模  
is [not] div by是否能被某数整除  
is [not] even是否为偶数  
is [not] even by $b即($a / $b) % 2 == 0  
is [not] odd是否为奇  
is not odd by $b即($a / $b) % 2 != 0
---------------------
作者:江户川柯南234
来源:CSDN
原文:https://blog.csdn.net/u011461231/article/details/52849718

 

posted @ 2018-02-27 17:10  青山不改,绿水长流  阅读(479)  评论(0编辑  收藏  举报