I'm using Primefaces 3.5 and I have ran into a pretty disturbing problem. The component looks like this in the xhtml:
<p:tab id="installApp" title="Install application">
<h:form enctype="multipart/form-data">
<p:panel header="Upload status" id="upld_status">
<p:dataTable id="errorTable" var="error"
value="#{applicationInstallerBean.uploadMsgs}">
<p:column headerText="Application">
<h:outputText value="#{error.filename}" />
</p:column>
<p:column headerText="Status">
<h:outputText value="#{error.errorMsg}" />
</p:column>
</p:dataTable>
</p:panel>
<p:remoteCommand name="clearPrevious" update="upld_status uploader" action="#{applicationInstallerBean.clearPrevious}" process="#this" />
<p:fileUpload id="uploader" multiple="true" dragDropSupport="true" onstart="clearPrevious()"
fileUploadListener="#{applicationInstallerBean.install}" uploadLabel="Install"
mode="advanced" update="#this upld_status" auto="false"
allowTypes="/(\.|\/)(zip)$/" styleClass="install_app_fileupload" />
</h:form>
<p:panel header="Help" toggleable="true">
<ui:include src="applicationInstallHelp.xhtml" />
</p:panel>
</p:tab>
Now the behaviour I'm experiencing is pretty strange:
For the first few times, uploading files with drag'n'drop method works fine. After a few uploads, the following errors appear totally undetermenistic:
FileUpload component disappears after pressing Upload button, only to reappear when I refresh the page
the onstart method gets called a lot of times during upload
the table containing the status of the upload does not refresh or only one of the files appear there, when multiple are uploaded
I also get a message from the browser that a script is running on this page and I can abort or continue
What I have tried:
Removing the h:form element, since this is an include in the index file, which already has a h:form element in it
Result: basicly the same, with the difference, that dropping a file for the first time onto the component automatically uploads it, but auto is set to false
I have also tried emptying the browser cache, redeploying the application from a scratch, turning off multiple...all with no luck.
The files I'm uploading are 80k to 9mb.
From this it looks to me, that uploading too much files makes the whole thing go crazy, but I cannot really think of a solution. Any help would be appreciated.
Update: During testing I found that the onstart method ALWAYS fires more than once after the first upload. For the first time it only fires once. On the second upload about 7-10 times, on the third time it seems it keeps firing until I end the session. This is pretty strange and I think it may be the root of the problems. Any ideas on this?
Thank you in advance!
Related
I've created a TabControl following this and similar guides:
https://blazor-university.com/templating-components-with-renderfragements/creating-a-tabcontrol/
The relevant code on my test Tabs.razor page is:
<TabControl>
<TabPage Text="Tab 1">
<h1>The first tab</h1>
</TabPage>
<TabPage Text="Tab 2">
<h1>The second tab</h1>
</TabPage>
<TabPage Text="Tab 3">
<h1>The third tab</h1>
</TabPage>
</TabControl>
The pages inside the tabs themselves will have a lot more content than just one sentence. All the tabbed examples I've found just have the tab contents like this, flat on the page. Is there some way to make the tab content more modular, possibly having it live in separate files? I'd want it all to load on the page initialization, I'd just like to not have a big monster .razor page with the contents of all the tabs.
I'm not sure if I need nested layouts here or what, or how the rendering would work (I'll need the tab contents to behave like top-level razor pages with functions and submit actions, etc...).
Pretty new to this, obviously, and haven't been able to find an answer. Thanks in advance.
<TabPage Text="Tab 1">
<MyFirstTabbedComponent />
</TabPage>
and then develop MyFirstTabbedComponent.razor as a page/component.
enfin, you have already done something similar.
I have a web app that uses primefaces extensions.
If I use
<pe:documentViewer id="verPdf"
height="500"
name="/resources/pdf/#{utentesBean.nomeFile}" />
it does not render PDF in view.
if I use
<pe:documentViewer id="verPdf"
height="500"
name="/resources/pdf/441.pdf" />
it shows the PDF .
Can anyone give an idea ?
Thank you.
I am one of the developers of the document viewer component and I just tested it and it worked fine with both of the following:
<pe:documentViewer url="/sections/documentviewer/#{controller.bookFile}"/>
<pe:documentViewer library="books" name="#{controller.hoodFile}"/>
One thing I noticed above in your example is you were not using URL you were using "name" attribute and name is meant to be used with "library" as in my example above as a relative path to a resource folder called "books".
I think you want to change your code to...
<pe:documentViewer id="verPdf"
height="500"
library="pdf"
name="#{utentesBean.nomeFile}" />
I have a dialog in which user picks a record. After submitting, the transition runs a service, which loads data and then renders an output file.
<transition name="exportActiveBatch_LinkId" read-only="true">
<actions>
<service-call name="mantle.ledger.LedgerLoadingServices.runLinkId#Export" in-map="context+[batchId:batchIdPicker]" out-map="context" ignore-error="false"/>
<if condition="hasError==true">
<!--<message error="true">Error occurred '${errorMessage}'!</message>-->
<log message="Error occurred '${errorMessage}'!" level="error"/>
<else>
<!--<message error="false">Export successful.</message>-->
<log message="Export successful." level="info"/>
</else>
</if>
</actions>
<default-response type="none"/>
<error-response url="."/>
</transition>
Everything works fine, data is loaded correctly, screen is rendered and output file is generated. The problem is, that the dialog does not close and remains in modal.
I would expect the dialog to close, but that does not happen. How shall I treat the transition responses correctly?
Normally container-dialog dialogs don't close automatically when a form in them is submitted, there can be multiple forms or for other reasons you don't want this. Most of the time you wouldn't notice it because when a form is submitted a new page is loaded.
A user can easily close the dialog by clicking outside it or on the 'x', but you could also add some JavaScript to do this if you want it done automatically. These are standard Bootstrap dialogs so you can use the documentation on getbootstrap.com as a reference.
The "multiple files" feature enables to select more files for uploading. The listener is called after each transmission. But I don't know how many files will be uploaded by the component at all.
I would like to navigate to the next page after all the selected files were processed. Any suggestion is highly appreciated.
fileUploadListener="#{uploadBean.handleFileUpload}"
maybe not a good solution but you can use the oncomplete from p:fileUpload to trigger a hidden button, which invokes a action to navigate.
<p:fileUpload ... oncomplete="$('#btn').click()" />
and
<p:commandButton id="btn" action="#{myBean.actionToNavigate}" style="display:none;" />
I'm using ColdFusion 8 to and the object to create an xml document and then write the data to fields in an existing PDF file on our intranet. The problem is that I need the PDF to open in a new browser window, not the same browser window, which is what is happening now.
Is there any additional info I can pass along with the 'destination=' tag to force the PDF form to open in a new browser window?
Thanks in advance for all replies
Providing code examples in the future would be greatly appreciated and should expedite resolution. However, if I am understanding you correctly, and depending on your preference, then one of the following solutions should suffice.
ColdFusion (Server-side)
If you are NOT writing the newly populated PDF to disk:
<cfpdf name="variableName" />
<cfheader name="Content-Disposition" value="attachment; filename=filename.pdf" />
<cfcontent type="application/pdf" variable="#toBinary(variableName)#" />
OR
If you ARE writing the newly populated PDF to disk:
<cfpdf action="write" destination="c:\full\path\to\filename.pdf" />
<cfheader name="Content-Disposition" value="attachment; filename=filename.pdf" />
<cfcontent type="application/pdf" file="c:\full\path\to\filename.pdf" />
OR
HTML (Client-side)
Anchor Text
OR
JavaScript (Client-side)
window.open("/relative/url/to/pdf/populate/template.cfm", "windowName");
I was looking for the answer and coworker steered me towards this easy solution. This will open a pdf in a new web browser window.
test.pdf
index.cfm (calling page)
<cfheader name="Content-disposition" value="inline;filename=test.pdf">
<CFCONTENT TYPE="application/pdf" FILE="#url.filePath#" DELETEFILE="No">
showPdf.cfm