jsp 常用标签和操作

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>  


1. 加载jsp的两种方式: 
<jsp:include page="../common/common.jsp"/>
<jsp:include page="common/top.jsp"/>


2. jsp获取jsp路径的方式:
<%
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+ request.getServletPath(); 
%> 
<head>
<base href=" <%=basePath%>"> >
</head>


3. 对radio的选中:$("input[name='is_prepay'][value='0']").prop("checked",true);
3.1. 获取radio的值:
$('input:radio:checked').val();
$("input[type='radio']:checked").val();
$("input[name='rd']:checked").val(); 
   
4. 对checkedBox的选中:$("input[name='branchOfficeIds'][value=" + branchOfficeIds[i].value + "]").prop("checked",true);
4.1. 获取选中的checkbox的值:checkbox的一个组:$("input:checkbox[name='branchOfficeIds']:checked")


5. 获取属性的值:$("#is_point_ded").prop("checked");


6. 
<c:choose>
<c:when test="${empty userBranchOfficeId}">

</c:when>
<c:otherwise>

</c:otherwise>
</c:choose>


<c:choose> 
  <c:when test="${empty param.username}">   
    Nnknown user.  
  </c:when> 
  <c:when test="${param.username=='Tom'}">   
    ${param.username} is manager.  
  </c:when> 
  <c:otherwise>   
    ${param.username} is employee.  
  </c:otherwise> 
</c:choose>

7. 
<c:forEach items="${hotelSchemeList }" var="hotelScheme">
                                
                            </c:forEach>


8.
<c:if test="${hotelSchemeList== null || fn:length(hotelSchemeList) == 0}">
                           
                            </c:if>


9. 
<li><a href="javascript:;">人民广场</a></li>
<input type="hidden" name="wxUserId" id="wxUserId" value="${userOpenId}"/>
<fmt:formatDate value="${XXX.date}" pattern="yyyy-MM-dd"/> 
${fn:length(shoppingCart.products)}


10. 
$.ajax({
url:"${pageContext.request.contextPath}/admin/hotelScheme/toUpdateHotelScheme",
            data:{"id":id},
            type: "POST",
            dataType: "JSON",
async: false,
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            success:function(data){
                if(data != null){
               
                };
            },
        });


11. jquery this: $(this).attr('title', 'OK');


12. el对象获取属性:${wgiftEnterpriseInfo.enterprise_details }


13. 获取某元素的某属性的值:$("li[class='class-present']").text()


14. jquery,for循环:
$("i[style='display: block;']").each(function(){
     class_ids.push($(this).attr("data-id"));
    });



































































































  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值