0
votes

I am trying to create a download link in a JSF page. The page has many richfaces fields that have validation enabled. Some have validator methods attached to them, some just have the required attribute set to true. The download link is an h:commandlink element. This link is supposed to download a file from the server. When I click on the link, validation on a few fields is triggered. How can I avoid this?

Thanks.

2
try adding immediate=true to the linkDaniel

2 Answers

2
votes

Either put it in a separate form,

<h:form>
    ... other input fields ...
</h:form>
<h:form>
    <h:commandLink value="Download" action="#{bean.download}" />
</h:form>

or use immediate="true" so that all input fields which do not have this attribute set will be skipped in the process

<h:commandLink value="Download" action="#{bean.download}" immediate="true" />
0
votes

The issue was with the file on the server side. Issue resolved.