开发者

Why can't I use Spring:url in an href?

开发者 https://www.devze.com 2023-01-05 05:36 出处:网络
I have seen sever开发者_如何学Cal examples using <a href=\"<spring:url value=\'/about/\' />\" >About </a>

I have seen sever开发者_如何学Cal examples using

 <a href="<spring:url value='/about/' />" >About </a>

I try this and get an error from Jetty

Caused by: org.apache.jasper.JasperException: /WEB-INF/views/footer.jspx(6,22) The value of attribute "href" associated with an element type "null" must not contain the '<' character.

Is there some encoding setting I have overlooked?

This is unfortunate because the other examples of using spring url I have seen are ugly

<spring:url value='/about' var="about_url" />
<a href="${about_url}" title="About MyFit">About MyFit</a>

Do I really need an additional line for every hyperlink in my templates?

Is this something that is fairly trivial and I have overlooked?


You have a .jspx file, which must be a well-formed XML document. In .jsp files it would work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消