-Lorrin
At 12:49 PM 5/24/2003, you wrote:
>>>>> "Lorrin" == Lorrin Nelson <[EMAIL PROTECTED]> writes:
Lorrin> I have a table displaying a list of items, and on each row there is a "delete"
Lorrin> link that pops up a confirmation dialog and then deletes the item. This works:
Lorrin> <c:forEach var="template" items="${templates}">
Lorrin> <tr>
Lorrin> <td><c:out value="${template.name}" escapeXml="true"/></td>
Lorrin> <td>
Lorrin> <html:link action="/user/template/delete"
Lorrin> paramId="id" paramName="template" paramProperty="id"
Lorrin> onclick="return confirm('Really?')">
Lorrin> <fmt:message key="template.list.action.delete"/>
Lorrin> </html:link>
Lorrin> </td>
Lorrin> </tr>
Lorrin> </c:forEach>
Lorrin> My problem is the hardcoded 'Really?' -- instead, I want to use a message
Lorrin> resource and plug in the name of the item in the row, like so:
Lorrin> <fmt:message key="temple.delete.confirm"><fmt:param Lorrin> value="${template.name}"/></fmt:message>
Lorrin> That works fine if it's not inside the <html:link> tag, but inside the
Lorrin> <html:link> it doesn't get parsed at all. In fact, if I do 'Really <%=4+4%>?' I
Lorrin> don't even get 'Really 8', I get the unparsed text in the confirmation dialog..
Lorrin> Any suggestions? I'm not married to this approach; if I've gotta use old-skool
Lorrin> Struts tags instead of JSTL or do it as a form instead of a html:link that's
Lorrin> alright.
Well, the simple fix is to understand that expression scriptlets have to be the
entire attribute value, not just a portion. Instead of:
'Really <%=4+4%>?'
you would need
'<%= "Really" + (4 + 4) + %>?'
Alternatively, if you are using the nightly build of Struts, you could use the "Struts-EL" contrib library, which gives you the ability to reference EL expressions in the attributes of the Struts tags.
-- =================================================================== David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP; SCWCD
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

