All,
I'm working in JSF / Jave / Primefaces.
When the user clicks a command button, I'd like to grab the box number and open up two different URLs at once, which would give the end user two different files to download.
I've tried quite a few suggestions and, so far, I've been unsuccessful. I'd prefer to not use JS if possible, but am open to suggestions.
I tried to just repeat the URL build and call again, but that did not work.
Thanks for any suggestions!
Christina
JSF:
<p:commandButton value="Open / Print Documentation" icon="fa fa-folder-open"
id="ajax" style="height:40px;" update="growl"
rendered='#{userManager.hasRole("RecordsManagementEndUsers")}'
actionListener="#{dashboardView.openPdf}">
</p:commandButton>
Java:
public void openPdf(ActionEvent actionEvent) {
String response = confirmBoxId(boxNumber);
if (response == "in system") {
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
String url =
"http://linkGoesHere.xdo?_xpt=1&_xf=pdf&rec_num=" +
boxNumber + "&_xt=CM_RECTRANS";
try {
FacesContext.getCurrentInstance()
.getExternalContext()
.redirect(url);
} catch (IOException e) {
e.printStackTrace();
}
} else {
addMessageWarn("Box number " + boxNumber + " was not found in the system. Please try again.");
}
}
The second URL would be something like this:
"http://linkGoesHere.xdo?_xpt=1&_xf=pdf&rec_num=" + boxNumber + "&_xt=labels";