Author |
Message |
|
Hi,
Thanks a lot Bjorn, My code is working I just need to run it into separate dialog box. And you're right it is only intended for short file size. I was not yet try the code that you have given to upload a larger size.
Another question, I have a fileupload button in my row in the grid and when I try to click the button, the current row of the grid is not being highlighted, only the file browser will popup. Is there any way that when I click the fileupload button,
the file browser will popup and at the same time the current row will be also highlighted?
|
|
|
here's the screenshot of the output, nothings gonna happen when I click the load pdf button to choose pdf file.
|
|
|
Why is it the pdf viewer does not work ?
here's the code below:
jsp:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="t" uri="/WEB-INF/eclnt"%>
<!-- ========== CONTENT BEGIN ========== -->
<f:view>
<h:form>
<f:subview id="PDFViewerg_sv">
<t:rowbodypane id="g_1" padding="0" >
<t:row id="g_2" >
<t:fileuploadbutton id="g_3" actionListener="#{d.PDFViewer.onNewMethod}" fileextensions="pdf" maxfilesize="5000000" text="Load PDF" />
</t:row>
<t:row id="g_4" >
<t:pdfrenderer id="g_5" bgpaint="rectangle(0,0,100%,100%,#000000A0,#00000040,vertical)" filename="{temp}/mypdf.pdf" height="100%" padding="top:10;bottom:5;left:10;right:10" pdf="#{d.PDFViewer.mypdf}" rendered="true" width="100%" withprintdialog="true" />
</t:row>
<t:rowstatusbar id="g_6" />
</t:rowbodypane>
<t:pageaddons id="g_pa"/>
</f:subview>
</h:form>
</f:view>
<!-- ========== CONTENT END ========== -->
java serverside:
package managedbeans;
import java.io.Serializable;
import org.eclnt.editor.annotations.CCGenClass;
import org.eclnt.jsfserver.defaultscreens.Statusbar;
import org.eclnt.jsfserver.elements.events.BaseActionEventUpload;
import org.eclnt.jsfserver.elements.util.Trigger;
import org.eclnt.jsfserver.managedbean.IDispatcher;
import org.eclnt.jsfserver.pagebean.PageBean;
import org.eclnt.jsfserver.util.WebResourceReader;
import org.eclnt.util.file.FileManager;
import org.eclnt.util.valuemgmt.ValueManager;
import javax.faces.event.ActionEvent;
@CCGenClass (expressionBase="#{d.PDFViewer}")
public class PDFViewer
extends PageBean
implements Serializable
{
protected String m_mypdf;
public String getMypdf(){return m_mypdf;}
public void setMypdf(String value){this.m_mypdf = value;}
byte[] bytes;
public byte[] getBytes(){return bytes;}
public void setBytes(byte[] value){this.bytes = value;}
public void onNewMethod(javax.faces.event.ActionEvent event) {
try{
if (event instanceof BaseActionEventUpload) {
BaseActionEventUpload base = (BaseActionEventUpload) event;
bytes = base.getHexBytes();
m_mypdf = ValueManager.encodeHexString(bytes);
}
}catch (Throwable throwable){
throwable.toString();
}
}
// ------------------------------------------------------------------------
// inner classes
// ------------------------------------------------------------------------
/* Listener to the user of the page bean. */
public interface IListener
{
}
// ------------------------------------------------------------------------
// members
// ------------------------------------------------------------------------
private IListener m_listener;
// ------------------------------------------------------------------------
// constructors & initialization
// ------------------------------------------------------------------------
public PDFViewer() {
}
public String getPageName() { return "/PDFViewer.jsp"; }
public String getRootExpressionUsedInPage() { return "#{d.PDFViewer}"; }
// ------------------------------------------------------------------------
// public usage
// ------------------------------------------------------------------------
/* Initialization of the bean. Add any parameter that is required within your scenario. */
public void prepare(IListener listener)
{
m_listener = listener;
}
// ------------------------------------------------------------------------
// private usage
// ------------------------------------------------------------------------
}
thanks for the help
|
|
|
thaks Bjorn you've get what I mean, Your answer will help a lot
|
|
|
Ok . because inorder to display image in the UI it needs the specific path of the file
, so is there any way that when the user click the upload file button, the image file selected by the user will display in the UI ? Without getting the path of the selected file?
Thanks;
|
|
|
Hi everyone,
is there a way to get the path of the selected file during upload?
any idea please
thanks
|
|
|