JSP 未终止 <s:a>使用嵌套 OGNL 标记

2023-10-14Java开发问题
4

本文介绍了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 &lt;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>

这篇关于JSP 未终止 &lt;s:a&gt;使用嵌套 OGNL 标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何使用 JAVA 向 COM PORT 发送数据?
How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)...
2024-08-25 Java开发问题
21

如何使报表页面方向更改为“rtl"?
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)...
2024-08-25 Java开发问题
19

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

有没有办法在 Java 中检测 RTL 语言?
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)...
2024-08-25 Java开发问题
11

如何在 Java 中从 DB 加载资源包消息?
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)...
2024-08-25 Java开发问题
13

如何更改 Java 中的默认语言环境设置以使其保持一致?
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)...
2024-08-25 Java开发问题
13