Embedded jasper viewer in applet, but could not able to view on jsp?

0

I have successfully embedded jasperviewer in an applet. Here is the java code for it,

 

public class WebservicewithApplet extends javax.swing.JApplet
{
 
    public void init()
    {
           javax.swing.JPanel pnlMain = new javax.swing.JPanel();
 
                pnlMain.setLayout(new java.awt.BorderLayout());
 
                getContentPane().add(pnlMain, java.awt.BorderLayout.CENTER);
 
                    try
                    {
                    JServer js = new JServer();
                        js.setUrl("http://localhost:8080/jasperserver-pro/services/repository");
                        js.setUsername("jasperadmin");
                        js.setPassword("jasperadmin");
 
                        ResourceDescriptor rd = new ResourceDescriptor();
                        rd.setUriString("/reports/DemoSamples/StandardCharts");
                        rd.setName("DemoCharts);
                        Map params = new HashMap();
                        //params.put("Year","2012");
                        
                        WSClient client = new WSClient(js);
                        JasperPrint jasperPrint = client.runReport(rd, params);
                        JasperViewer.viewReport(jasperPrint);
                            if (jasperPrint != null)
                            {
                                    JRViewer viewer = new JRViewer(jasperPrint);
                                    pnlMain.add(viewer, BorderLayout.CENTER);
                            }
                    }
                    catch (Exception e)
                    {
                            StringWriter swriter = new StringWriter();
                            PrintWriter pwriter = new PrintWriter(swriter);
                            e.printStackTrace(pwriter);
                            JOptionPane.showMessageDialog(this, swriter.toString());
                    }
                        
    }
 
}
if i run this code, i get an applet which is showing a jasperviewer in it.
But my problem is, if i extracted the code in jar file and called in a jsp page its just displaying an white page.  (I have checked the browser issues and sure that all swing/normal applets are working fine)
jsp code:
<body>
<%@page 
import = "com.jaspersoft.ireport.jasperserver.JServer,com.jaspersoft.ireport.jasperserver.ws.WSClient,
com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor,
net.sf.jasperreports.engine.JasperPrint,
net.sf.jasperreports.view.JRViewer,
net.sf.jasperreports.view.JasperViewer,java.util.Map,java.util.HashMap,
net.sf.jasperreports.engine.JasperExportManager,
java.io.*,
java.util.Scanner" 
%>
<OBJECT width="500" height="500" data="test/WebservicewithApplet.class" type="application/x-java-applet">
        <PARAM name="code" value="test/WebservicewithApplet.class">
        <PARAM name="archive" value="WebservicewithApplet.jar,jasperreports-applet-5.2.0.jar">
</OBJECT>
<Applet code="test.WebservicewithApplet.class" archive="WebservicewithApplet.jar,jasperreports-applet-5.2.0.jar" height="600" width="600">no</Applet>
</body>
Tried with both object,applet tags but no result.
Test package is having java class which is showing jasperviewer in an applet. 
I have exported java class to jar file in eclipse 'Export Jar File' Option.
 
Please provide suggestions where i went wrong???
 
Thanks & Regards,
Subhash
subhashreddy594's picture
Joined: Jul 29 2013 - 12:30am
Last seen: 4 years 12 months ago

0 Answers:

No answers yet
Feedback
randomness