Hi,
I have 2 issues for which I need guidance from you.
Issue 1:::
In my application I am trying to write a page where I am having one html
file with one wicket panel with id mapped to a table.
And in the java file I am creating columns with AbstractColumns. Then I am
populating the DataTable with id (which is specified in the html page),
columns (created using AbstractColumns), dataprovider (this feeds the row
data to the table), and rows per page.
Coming to the columns, except one column all other are Label. And do not see
any problem.
But when I want to have a DownloadLink for a file present on the server I am
facing issue. I want to have the fileName as the DownloadLink which is not
happening. (Just to remind I am not using separate wicket ids for each
field). I am passing id, File (file object present on the server) and
fileName (this is the name displayed on the popup when the link is clicked).
This results in the Id being displayed in the place of link field and when
this is clicked I am able to download the file.
I need help on how do I get the fileName as download link instead of id.
new AbstractColumn(new MessageModel(COLUMN_NAME)) {
@Override
public void populateItem(Item cellItem, String id, IModel rowModel) {
final MyClass myClass = (MyClass) rowModel.getObject();
final File fileDirectory = new File(filePath);
cellItem.add(new DownloadLink(id, new File(fileDirectory, csvFile),
myClass.getFile()));
}
}
Issue 2 :::
I tried on more approach. For the download link I declared a Label with id
and href for the link. We are able to get the link but when clicked it is
appending the ip of the server which I do not want. I could not find any way
to remove that IP. Following is the code snippet used in side the column:
cellItem.add(new Label(componentId, "<a onclick=\"window.open('" +
filePath + "', '_blank'); target=\"_blank\"
href=\"" + filePath + "\" > " + fileName + "
").setEscapeModelStrings(false));
Thanks
Karthik S Patawardhan
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]