I am following the Struts 2 Tutorial – Using Struts 2 Tags
So far everything have been working as expected until I added the following to index.jsp:
<s:url action="hello" var="helloLink">
<s:param name="userName">Bruce Phillips</s:param>
</s:url>
<p><a href="${helloLink}">Hello Bruce Phillips</a></p>
Expected result is that the anchor-link (Hello Bruce Phillips) should be substituted with corresponding URL for hello.action with parameter userName encoded, however no substitution occurs and this is how the element renders:
<p>
<a href="${helloLink}">Hello Bruce Phillips</a>
</p>
Is there anything wrong with my syntax?
Environment:
- Tried in both GlassFish 2.1 and 3.1.1, same unexpected result.
- Struts 2.2.3.1
- Mac (Lion) with java6 jdk
- Tag definition: <%@ taglib prefix=”s” uri=”/struts-tags” %>
If no JSP EL evaluates, check these:
<el-ignored>true</el-ignored>in<jsp-config>.I’m guessing the first one.
@user873670’s answer will also work, but is not necessary in a properly-configured app.