miramon Posted October 19, 2009 Share Posted October 19, 2009 Hi ,I have generated jasper reports and i used JasperViewer and everything works great.Now I want to view this JasperViewer in client side.I've tried the examples in demo/samples/webapp/applet/EmbeddedViewerApplet ,but EmbeddedViewerApplet throws me an exception:java.lang.NullPointerException.I've check and I found that JRViewerSimple returns me null.I'm sure jasperPrint is not null. How do I solve this problem. Am I missing something? Thanks in advance Link to comment Share on other sites More sharing options...
miramon Posted October 19, 2009 Author Share Posted October 19, 2009 I got the solution. I created a parameterised constructor with jasperPrint and it that i initialised 'this.jasperprint' and also called initComponents(). No more errors.But now I'm trying to view this applet in a jsp by defining :<jsp:plugin type="applet" code="EmbeddedViewerApplet.class" width="400" height="400"> <jsp:fallback> <p>Unable to load applet</p> </jsp:fallback></jsp:plugin>I'm getting the jsp with the panel , when i click on the error link its showing java.lang.ClassNotFoundException.Somebody pls help me.Thanks. Link to comment Share on other sites More sharing options...
firass88 Posted February 20, 2012 Share Posted February 20, 2012 sallam ,i have the same exception that you got, what i did first was to take the sample of webapp ofjasperreports 3.7.6 and make it run.two ways to do so:1.1 use the ant commands (*) then create the jasper-webapp.war and put it in ..\tomcat.6.0\webapps\ folder * http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/getting.started.html1.2 create a new project using an IDE like intellij then copy all the webapp sample folder to it. then attach the ant to build.xml file in this folder. after that run the ant and compile/run the project.2. open the browser in localhost:[port] then you can see Web Application Samplefirst goto applet viewr in left menu and follow this link: "click here to test whether your browser can run Swing applets or not" if you could run it and see applet rectangle then you have no problem if not try to open these pages above using another browser like "google chroom" , he might want to download the java from internet just follow the steps.3. after running the test goto home page of this sample and follow the pages by this order compile JRXML , fill report, then click the Embedded Viewer Applet link in "applet viewer" page and see if it running correctly.4. try to understand the sample and take a look at the applet folder (inside the webapp sample) you can see three jars: jasperreports-applet-3.7.6.jar,commons-logging-1.0.4.jar,commons-collections-2.1.1.jaropen the viewer.html and see how sample is using this jars and calling the "EmbeddedViewerApplet.class" throw javascript.5. in the servlet, write the report data to a pdf file on the server and then from the applet get a handle to the applet context object and invoke the showDocument method passing the path where I saved the pdf file. taken from: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=1291and http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=62166i hope this can help sombody ... :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now