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 的问题是什么吗
Hi i have a custom tag in 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"))%>'>
It is working fine except for
helpURL='<%=((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString()%>/web/ABCGlossary.jsp'
it is not getting translated in jsp
it is giving output some like
%=((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString()%>/web/ABCGlossary.jsp
Can you please help me what is the problem it have enable rtexprvalue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能取决于您混合脚本表达式和文字的方式,您混淆了 JSP 编译器。
如果这是 JSP 2.0 或更高版本,您可以通过使用 EL 表达式而不是 scriptlet 来使其更具可读性,如下所示:
如果做不到这一点,只需将 helpURL 的值分配给单独的变量然后引用它即可让您的生活更轻松在你的标签中
This is likely down to the way you're mixing script expressions and literals, you're confusing the JSp compiler.
If this is JSP 2.0 or higher, you can make this much more readable by using EL expressions rather than scriptlets, like this:
Failing that, just make your life easier by assigning the value of the helpURL to a seperate variable and then referring to it in your tag