[英]Problem in Custom tag in JSP
嗨,我在JSP中有一个自定义标签
<dc:drawMultiSelect
availableLabel='<%=request.getAttribute("availableCoreColumn").toString()%>'
selectedLabel='<%=request.getAttribute("selectedCoreColumns").toString()%>'
availableCName="selectCol"
selectedCName="selectedCol"
availableCId="select1"
selectedCId="select2"
sort="off"
columnHelp="on"
helpURL='<%=((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString()%>/web/ABCGlossary.jsp'
selectSize="8"
selectWidth="250px"
selectMultiple="true"
availableMap='<%=((HashMap) request.getAttribute("availableColMap"))%>'
selectedMap='<%=((HashMap) request.getAttribute("selectedColMap"))%>'>
除helpURL ='<%=(((Map)request.getAttribute(“ constants”))。get(“ WEB_CONTEXT”)。toString()%> / web / ABCGlossary.jsp'之外,它都正常运行
它没有在jsp中得到翻译,而是输出%=((Map)request.getAttribute(“ constants”))。get(“ WEB_CONTEXT”)。toString()%> / web / ABCGlossary.jsp
能否请我帮我启用rtexprvalue有什么问题
这很可能是混合脚本表达式和文字的方式,这使JSp编译器感到困惑。
如果是JSP 2.0或更高版本,则可以使用EL表达式而不是scriptlet使其更具可读性,如下所示:
helpURL="${requestScope.constants.WEB_CONTEXT + '/web/ABCGlossary.jsp'}"
失败的话,只需将helpURL的值分配给单独的变量,然后在标记中引用它,就可以使您的生活更轻松
<% String helpURL = ((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString() + '/web/ABCGlossary.jsp' %>
helpURL='<%= helpURL %>'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.