日期:2014-05-16 浏览次数:20612 次
? ? ?最近做些前台页面表现层的工作,对这些东西好久没有接触了。遇到一些问题,总结一下:
?
? ? * 自定义标签文件:
? ? ? ? ? ?在用自定义标签实现功能时候总是报错,如下:
javax.servlet.jsp.JspException: javax.el.PropertyNotFoundException: Property 'header' not found on type java.lang.String
具体代码如下:
?
<%@tag pageEncoding="UTF-8" body-content="empty" import="com.express.platform.model.system.*"%> <%@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" %> <%@ attribute name="module" required="true" rtexprvalue="true" %> <div class="index_model"> <div class="index_model_head"> <c:if test="${not empty module.header }"> <c:if test="${not empty module.header.url }"> <a href="${module.header.url }"> </c:if> <c:if test="${not empty module.header.text }"> ${module.header.text } </c:if> <c:if test="${not empty module.header.url }"> </a> </c:if> </c:if> </div> <c:forEach items="${module.tabSelector }" var="tab"> <c:if test="${not empty tab.tab && not empty tab.tab.text}"> <c:set value="true" var="isShow" scope="page"></c:set> </c:if> <c:remove var="tab"/> </c:forEach> <c:if test="${not empty isShow && isShow == \"true\"}"> <div class="index_model_tab"> <c:forEach items="${module.tabSelector }" var="tab"> <div>${tab.tab.text }</div> </c:forEach> </div> <c:remove var="tab"/> </c:if> <div class="clear"></div> <div class="index_model_content"> <c:forEach items="${module.tabSelector }" var="tab"> <div class="index_model_tab_content"> <table> <tr> <c:forEach items="${tab.columnsWidth }" var="colWidth"> <td width="${colWidth }"></td> </c:forEach> </tr> <c:forEach items="${tab.tableData }" var="rowData"> <tr> <c:forEach items="${rowData }" var="colData" varStatus="index"> <c:choose> <c:when test="${colData.type.type == \"url\" || colData.fold }"> <td class="index_model_column_main"> </c:when> <c:otherwise> <td > </c:otherwise> </c:choose> <c:choose> <c:when test="${colData.type.type == \"img\" }"> <img src="${colData.url }" /> </c:when> <c:when test="${colData.type.type == \"url\" }"> <a href="${colData.url }" title="${colData.text }">${colData.text }</a> </c:when> <c:otherwise> ${colData.text } </c:otherwise> </c:choose> </td> </c:forEach> </tr> </c:forEach> </table> </div> </c:forEach> </div> <div class="clear"></div> <div class="index_model_foot"> <c:forEach items="${module.footer }" var="footer" > <c:choose> <c:when test="${footer.type.type == \"img\" }"> <img src="${footer.url }" /> </c:when> <c:when test="${footer.type.type == \"url\" }"> <a href="${footer.url }" title="${footer.text }">${footer.text }</a> </c:when> <c:otherwise> ${footer.text } </c:otherwise> </c:choose>