This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes how do I use html:link to reference a dynamic file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how do I use html:link to reference a dynamic file?" Watch "how do I use html:link to reference a dynamic file?" New topic

how do I use html:link to reference a dynamic file?

Toni Heightland

Joined: Oct 25, 2005
Posts: 7
Hi all,

In my application, a user can generate a file containing search results, which can later be emailed as an attachment. I'm wanting to give the user an option to preview the attachment before sending the email with a "Click here to preview attachment" kind of feature. The name of the file changes depending on the search that the user originally performed. I cannot figure out how to reference the file name.
I've done a lot of searching, but I have not come up with anything.
I've tried:

The attachmentFileName is a property of the form bean associated with this action, as shown below.

I hope this is clear. If not, let me know and I'll give another shot at explaining.
Any help would be greatly appreciated!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
In order to use an EL expression in an <html:xxxx> tag, you must provide the taglib definition for the struts-el version of the tags:

<%@ taglib uri="" prefix="html" %>

You must also have the struts-el.jar file in your classpath.

With these things in place, the EL expression should be:


In this situation, you're not really gaining much by using a Struts tag. You might want to consider using the plain HTML tag:

<a href="${EmailForm.attachmentFileName}">Click here</a>

This assumes you're using JSP 2.0

if not, it would be

<a href="<cut value='${EmailForm.attachmentFileName}' />">Click here</a>
[ April 17, 2006: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: how do I use html:link to reference a dynamic file?
jQuery in Action, 3rd edition