JSP 未终止 <s:a>使用嵌套 OGNL 标记
我有一些 OGNL 用于将 <s:a>
的 href 元素填充到由 Google UserService 处理的动态生成的 URL.
I have some OGNL I am using to populate the href element of an <s:a>
to a dynamically produced URL, handled by the Google UserService.
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="requestUri" value="%{#context['com.opensymphony.xwork2.dispatcher.HttpServletRequest'].requestURI}" />
<s:a href="%{#action.userService.createLoginURL("<c:out value="${requestUri}"/>");}">Sign in</s:a>
但是,我收到一条错误消息,提示 <s:a>
标记未终止.我尝试转义内部语音标记,并使用单引号,但到目前为止,我总是收到相同的错误消息.
However, I am getting an error saying the <s:a>
tag is unterminated. I have tried escaping inner speechmarks, and using single quotes but so far I have always been greeted with the same error message.
(11,71) Unterminated <s:a tag
我一辈子都看不出哪里出了问题.也许对这种语言有更好洞察力的人会看到我看不到的东西.
I can't for the life of me see what is wrong. Maybe someone with better eyes for the language will see something I cannot.
推荐答案
你不能在Struts标签的属性中使用JSP标签,但是你可以在那里使用OGNL.
You cannot use JSP tags in Struts tag's attributes, but you can use OGNL there.
另外请注意,您可以在 Struts 标签的属性中使用 OGNL only.在大多数情况下,OGNL 在服务器上执行一次,你不应该使用嵌套的 OGNL 或任何你称之为的东西.可能是这个问题会告诉你如何使用你称为nested OGNL.
Also note, that you can use OGNL only in Struts tag's attributes. And in most cases OGNL is executed once on the server, you shouldn't use nested OGNL or whatever you call it. May be this question will show you how to use you called nested OGNL.
<s:set var="requestUri" value="%{#context['com.opensymphony.xwork2.dispatcher.HttpServletRequest'].requestURI}" />
<s:a href="%{#action.userService.createLoginURL(#requestUri)}">Sign in</s:a>
相关文章