aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
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
Author

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

Toni Heightland
Greenhorn

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="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>

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

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

${EmailForm.attachmentFileName}

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 ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do I use html:link to reference a dynamic file?