You can use EL outside of Struts tags.
Try <jsp:param name="title" value="${pageTitle}" />.
Properties in an action will be at the top of the stack.
Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
From: Wes Gamble <[EMAIL PROTECTED]>
Reply-To: Struts Users Mailing List <[email protected]>
Date: Mon, 19 May 2008 16:25:26 +0000
To: <[email protected]>
Subject: How to pass OGNL expressions to JSP includes
All,
It's been a while since I've done any Struts (JSP for that matter)
development, and I'm trying to get started with Struts 2.
Here's a very simple template that pulls in an include that provides the
<head>...</head> content for the page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ taglib prefix="s" uri="/struts-tags" %>
<jsp:include page="/include/head.jsp" flush="true">
<jsp:param name="title" value="<s:property value="pageTitle"/>" />
<jsp:param name="companyName" value="<s:property value="companyName"/>" />
</jsp:include>
<body>
</body>
</html>
I have an action that sets the values of pageTitle and companyName and I've
verified that they have values.
My problem is I don't know how to co rrectly pass the pageTitle and
companyName values set in my action (and retrievable only through OGNL,
AFAIK) to the include via the standard <jsp:param> tag. What is above
doesn't work because of the double quotes. So, here are my questions...
1) Is there a way to quote the contents of the <s:property> tag so that I
can pass it successfully to the include?
2) Do I have to put the value of <s:property value="pageTitle"> (for
example) into a local JSP variable just to pass it to the include?
What am I doing wrong?
Thanks,
Wes
This email and any attachments ("Message") may contain legally privileged
and/or confidential information. If you are not the addressee, or if this
Message has been addressed to you in error, you are not authorized to read,
copy, or distribute it, and we ask that you please delete it (including all
copies) and notify the sender by return email. Delivery of this Message to any
person other than the intended recipient(s) shall not be deemed a waiver of
confidentiality and/or a privilege.