How to Run a JasperReport in  web application

hi ,
I am Deepan,
Proffesional:Programmer,
I Used the Ireport for jasper Report,Iam Running in webApplication(JSP,Tomcat as Server),
I used the line
JasperViewer.viewReport(jasperPrint,false);
it work well in server system,that is where the Apache Tomcat is installed,It displayed the Print format for Taking Print,
Well,when i run the application in client System,PrintFormat get Displayed in Server System(Tomcat installed),
But i need the PrintFormat to display in Client System ,Where they Work...
Help Me,
Thanks iN advance....
I attached the Code here for reference
(Line in Bold)
package jasper.testpkg;
//import static chequebook.db.Conf.getAppHome;
import java.util.HashMap;
import java.util.Vector;
//import java.util.ArrayList;
//import model.Load;
import model.BillPrePrintModel;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;
//import chequebook.vo.ChequeBookVO;
public class BillPrePrint {
public static JasperTestCustomDataSource getDefaultCustomDS(String billno){
     //String billno="";
     JasperTestCustomDataSource customDataSource = new JasperTestCustomDataSource();
     BillPrePrintModel bpm=new BillPrePrintModel();
//String billno="";
Vector billdata=bpm.Collectbilldata(billno);
String mybillno="",mybilldate="",mybillcustomer="",mybilltoaddress="",mybilltotal="0" ;
System.out.println("billData"+billdata);
if(billdata.size()!=0)
{     mybilltotal=billdata.get(billdata.size()-5).toString();
     mybillno=billdata.get(billdata.size()-4).toString();
     mybilldate=billdata.get(billdata.size()-3).toString();
     mybillcustomer=billdata.get(billdata.size()-2).toString();
     mybilltoaddress=billdata.get(billdata.size()-1).toString();
     System.out.println("MYBILLNO:"+mybillno);
     System.out.println("MYBILLDATE:"+mybilldate);
     JasperTestDataVO dataDS = new JasperTestDataVO();
     dataDS.setBillNo(mybillno);
     dataDS.setBillDate(mybilldate);
     dataDS.setBillFrom(mybillcustomer);
     dataDS.setBillTo(mybilltoaddress);
     dataDS.setTotamount(mybilltotal);
     JasperTestLineDataVO line = null;
     dataDS.setLineData(new Vector<JasperTestLineDataVO>());
//line = new JasperTestLineDataVO();
System.out.println("Vector Bill Data"+billdata);
     private String fdate="";
     private String regno="";
     private String gcno="";
     private String ffrom="";
     private String fto="";
     private String docref="";
     private String pkgs="";
     private String weight="";
     private String trucktype="";
     private String amount="0";
     private String totalamt="0";
     for(int i=0;i<billdata.size()-5;i+=10)
          line = new JasperTestLineDataVO();
          line.setFdate(billdata.get(i).toString());
          line.setRegno(billdata.get(i+1).toString());
          line.setGcno(billdata.get(i+2).toString());
          line.setFfrom(billdata.get(i+3).toString());
          line.setFto(billdata.get(i+4).toString());
          line.setDocref(billdata.get(i+5).toString());
          line.setPkgs(billdata.get(i+6).toString());
          line.setWeight(billdata.get(i+7).toString());
          line.setTrucktype(billdata.get(i+8).toString());
          line.setAmount(billdata.get(i+9).toString());
          dataDS.getLineData().add(line);
               System.out.println("billdata.get(i).toString()"+billdata.get(i).toString());
               System.out.println("billdata.get(i+1).toString()"+billdata.get(i+1).toString());
               System.out.println("Checking Line Loop"+ (i+1));
     line.setItemName("Item Type 1");
     line.setLineNum("1");
     line.setPrice("1.09");
     line.setQty("100");
     dataDS.getLineData().add(line);
     line = new JasperTestLineDataVO();
     line.setItemName("Item Type 2");
     line.setLineNum("2");
     line.setPrice("2.09");
     line.setQty("50");
     dataDS.getLineData().add(line);
     line = new JasperTestLineDataVO();
     line.setItemName("Item Type 3");
     line.setLineNum("3");
     line.setPrice("3.19");
     line.setQty("25");
     dataDS.getLineData().add(line);*/
customDataSource.setDataDS(dataDS);
return customDataSource;
     public void MyImp(String billno){
          JasperDesign jasperDesign;
          try {
               //System.out.println("billdata"+billdata);
               jasperDesign = JRXmlLoader.load("C:\\Program Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\Cargo\\WEB-INF\\RMPrePrint.jrxml");
               JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
               HashMap param = new HashMap();
               JasperPrint jasperPrint;
               jasperPrint = JasperFillManager.fillReport(jasperReport, param,getDefaultCustomDS(billno));
               JasperExportManager.exportReportToHtmlFile(jasperPrint,"D:\\TEstJagan1.html");
               //JasperExportManager.exportReportToHtmlFile(jasperPrint,"D:\\TEst.html");
               System.out.println("your file updated to HTML file ");
               JasperViewer.viewReport(jasperPrint,false);_
          } catch (JRException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
class JasperTestDataVO{
     private String billNo="";
     private String billDate="";
     private String billFrom="";
     private String billTo="";
     private String totalamt="0";
     Vector<JasperTestLineDataVO> lineData=new Vector<JasperTestLineDataVO>();
     public Vector<JasperTestLineDataVO> getLineData(){
          return lineData;
     public void setLineData(Vector<JasperTestLineDataVO> pData){
          lineData=pData;
     public String getBillDate() {
          return billDate;
     public void setBillDate(String billDate) {
          this.billDate = billDate;
     public String getBillNo() {
          return billNo;
     public void setBillNo(String billNo) {
          this.billNo = billNo;
     public String getBillFrom() {
          return billFrom;
     public void setBillFrom(String billFrom) {
          this.billFrom = billFrom;
     public String getBillTo() {
          return billTo;
     public void setBillTo(String billTo) {
          this.billTo = billTo;
public String getTotamount() {
          return totalamt;
     public void setTotamount(String totalamt) {
          this.totalamt = totalamt;
class JasperTestLineDataVO{
     private String lineNum="";
     private String itemName="";
     private String qty="0";
     private String price="0";
     private String fdate="";
     private String regno="";
     private String gcno="";
     private String ffrom="";
     private String fto="";
     private String docref="";
     private String pkgs="";
     private String weight="";
     private String trucktype="";
     private String amount="0";
     //regno="",gcno="",ffrom="",fto="",docref="",pkgs="",weight="",trucktype="",amount="",totalamt="0";
     public String getFdate() {
          return fdate;
     public void setFdate(String fdate) {
          this.fdate = fdate;
     public String getRegno() {
          return regno;
     public void setRegno(String regno) {
          this.regno = regno;
     public String getGcno() {
          return gcno;
     public void setGcno(String gcno) {
          this.gcno = gcno;
public String getFfrom() {
          return ffrom;
     public void setFfrom(String ffrom) {
          this.ffrom = ffrom;
public String getFto() {
          return fto;
     public void setFto(String fto) {
          this.fto = fto;
public String getDocref() {
          return docref;
     public void setDocref(String docref) {
          this.docref = docref;
public String getPkgs() {
          return pkgs;
     public void setPkgs(String pkgs) {
          this.pkgs = pkgs;
public String getWeight() {
          return weight;
     public void setWeight(String weight) {
          this.weight = weight;
public String getTrucktype() {
          return trucktype;
     public void setTrucktype(String trucktype) {
          this.trucktype = trucktype;
public String getAmount() {
          return amount;
     public void setAmount(String amount) {
          this.amount = amount;
class JasperTestCustomDataSource implements JRDataSource{
     int size = 0;
     int index=-1;
     private JasperTestDataVO dataDS=null;
     public void setDataDS(JasperTestDataVO pDataDS){
          dataDS=pDataDS;
          size=pDataDS.getLineData().size();
          System.out.println("LineData Size"+String.valueOf(size));
     public Object getFieldValue(JRField f) throws JRException {
          // TODO Auto-generated method stub
          String trucktype="";
          Object ret=null;
          if(f.getName().equals("billno")){
                              ret=dataDS.getBillNo();
          if(f.getName().equals("billdate")){
                              ret=dataDS.getBillDate();
          if(f.getName().equals("toaddress")){
                              ret=dataDS.getBillFrom();
          if(f.getName().equals("bytoaddress")){
                              ret=dataDS.getBillTo();
          if(f.getName().equals("fdate")){
                         ret=dataDS.getLineData().get(index).getFdate();
if(f.getName().equals("regno")){
                         ret=dataDS.getLineData().get(index).getRegno();
if(f.getName().equals("gcno")){
                         ret=dataDS.getLineData().get(index).getGcno();
if(f.getName().equals("from")){
                                   ret=dataDS.getLineData().get(index).getFfrom();
if(f.getName().equals("to")){
                         ret=dataDS.getLineData().get(index).getFto();
if(f.getName().equals("docref")){
                         ret=dataDS.getLineData().get(index).getDocref();
System.out.println("Index inside"+String.valueOf(index));
if(f.getName().equals("pkgs")){
                         ret=dataDS.getLineData().get(index).getPkgs();
if(f.getName().equals("weight")){
                         ret=dataDS.getLineData().get(index).getWeight();
if(f.getName().equals("trucktype")){
                         ret=dataDS.getLineData().get(index).getTrucktype();
          trucktype=String.valueOf(dataDS.getLineData().get(index).getTrucktype());
          System.out.println("TRuck Type:::::"+index+":::"+trucktype);
if(f.getName().equals("amount")){
                         ret=dataDS.getLineData().get(index).getAmount();
if(f.getName().equals("total")){
                         ret=dataDS.getTotamount();
          return ret;
     public boolean next() throws JRException {
          // TODO Auto-generated method stub
          index++;
          System.out.println("Index"+String.valueOf(index));
          boolean ret=true;
          if(index>=size){
               ret =false;
          return ret;
}

Forms 6i and above yes it is possible.
Forms 6i can be deployed both web and client/server, but 9i and above is only for web deployment.
If you want to deploy for testing purposes you can run the forms from the forms builder using OC4J Instance, but for production deployment you need to have OAS, Oracle Application Server.
Tony

Similar Messages

  • How to run notepad from a web application

    hi
    can any body know,how to run notepad from a web application under tomcat

    You already asked this question:
    http://forum.java.sun.com/thread.jspa?threadID=5150005&messageID=9561597
    Obviously running notepad on the clients PC is not possible (ignoring active x)

  • How to run background process with web application

    Hi,
    I have a web application , a servlet. I would like to have a background process that collecting data for my servlet.
    How can I achieve this? can someone point me to a tutorial or example?
    Also, would it be possible to share an object between the background process and myservlet?
    Thanks,

    Thanks for the idea.
    I had the background process running. :)
    But I'm still do not understand this part to share an object such as Java Map (<id,myobject>), what do you mean by "task a property of my ServletContextListener" ?
    BalusC wrote:
    If you make the task a property of your ServletContextListener implementation and put the implementation in the application scope, then you can access it from any servlet.Do you mind explain to me a bit more I'm still fairly new with this or maybe if you know an example.
    Here's my code snippet so far. How can I share myList to MyServlet?
    public class MonitorTimer extends TimerTask
           private Map<String, Channel> myList;
         @Override
         public void run()
              System.out.println("Monitor Timer times up");
              //Clear the map before fill with the new data
              if(myList!= null)
                   myList.clear();
              loadConfig();
            private void getData()
               //fill myList with data
    public class MyContextListener implements ServletContextListener
         @Override
         public void contextDestroyed(ServletContextEvent arg0)
              // TODO Auto-generated method stub
         @Override
         public void contextInitialized(ServletContextEvent arg0)
              System.out.println("Context Initialized");
              Timer timer = new Timer();
              //Run MonitorTimer every 2 minutes
              timer.scheduleAtFixedRate(new MonitorTimer(), 10*1000,2*60*1000);
    public class MyServlet extends HttpServlet implements Servlet
         @Override
         public void destroy()
              // TODO Auto-generated method stub
              super.destroy();
         @Override
         protected void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException
    }Thank you so much for your help,
    Edited by: geek.shrek on Nov 4, 2009 1:50 PM

  • How to run ear file in java application server

    i want how to run .ear file in java application server
    1. i m created ear file
    2. i m created jar file (bean,home,remote)
    3.i m created war file(in the form of jsp)
    but till now i couldnt run ear file
    how to run
    please hel me

    You must create :
    1.Jar file
    2.War file
    And then put them into an ear file
    Exemple : myapp.ear contains
    myappEJB.jar
    myappWEB.war
    META-INF/application.xml
    and application.xml looks like this :
    <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee
                            http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
        <display-name>myapp</display-name>
        <description>Demo application</description>
        <module>
            <ejb>myappEJB.jar</ejb>
        </module>
        <module>
          <web>
             <web-uri>myappWAR.war</web-uri>
             <context-root>/myapp</context-root>
          </web>
        </module>
    </application>Good luck

  • How can run one JSF 1.1 application in Glassfish v2?

    Hello
    How can run one JSF 1.1 application in Glassfish v2?
    I need deploy one JSF 1.1 application in Glassfish v2. It's possible?
    Paulo

    in Glassfish v2 I have the messege error:
    java.lang.RuntimeException: WEB5002: Exception in handleBeforeEvent.
         at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:250)
         at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:106)
    [#|2007-08-14T10:49:16.438-0300|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=21;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=416049de-0564-4eb6-8d07-ac8f65f5f7fa;|ApplicationDispatcher[/lilya2] PWC1225: Allocate exception for servlet FacesServlet
    java.lang.RuntimeException: WEB5003: Exception in handleAfterEvent.
         at com.sun.web.server.J2EEInstanceListener.handleAfterEvent(J2EEInstanceListener.java:320)
    but in Tomcat 5.5 it work without problems.

  • How to create a file under web application root from java program

    how to create a file under web application root from java program like an action class?

    like an action class?Huh? What exactly is your requirement?
    Creating a file is usually done with java.io API. Read the java.io tutorials how to play with files.

  • How To run Currency translation for Consolidation Application in BPC NW

    In "How To do Currency Translation for Financial Application in BPC 7 NW", the author mention that there is another "How To run Currency translation for Consolidation Application in BPC NW", anybody know where to get it?

    Hi...
    Check if the below links are useful to you.....
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/6052a57b-8c64-2c10-b3a5-b0378ff21243&overridelayout=true
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0ea1fd8-d6d3-2a10-c1ab-e8164dd98316
    You can find all How-to docs in the below link
    http://wiki.sdn.sap.com/wiki/display/BPX/EnterprisePerformanceManagement%28EPM%29How-to+Guides

  • How to capture memory usage for web application

    In OATS openscripts, how to capture memory usage for web application? Does it have the exisitng java method that we can call to get the memory data (e.g. peak bytes, private bytes) consumed by web application?

    JProbe

  • How to Run scenario from the web using HTTP web page?

    Hi guys
    Please let me know How to Run scenario from the web using HTTP web page?
    Regards
    Janakiram

    Hi Janakiram,
    ODI provides web based UI for running the scenarios using Metadata Navigator (read only of ur ODI components) and Lighweight designer (u can edit the mapping here).
    Please explore how to install metadata navigator in ODI and have a look at ODI Setup document for more information.
    Thanks,
    Guru

  • Ho w to run exe from a web application

    hi
    is there any chance to run exe from a web application under tomcat.
    plz tell me

    Please make the extra effort to write out words such as "please" and "your". The extra keystrokes won't cost much in the way of time, and the enhanced clarity will be appreciated by those communicating on a forum with international readership.
    What don't you understand about the previous answers?

  • How to Hide HTML code of web application (applet)?

    hi
    On web, while running application, if user open View\Source from browser, he can see all HTML code (base_jini.html). The problem is that we can't afford to show source code to client, because it has DB connection inf (username/password) as well. How this html code can be hide from client machine?
    I think, i convey my prblom. If not, please run any web application and try to see source code from browser view menu, U will see that all configuration details are visible including db password. I suppose there should be some way to hide these details to client.
    Please help in this regard, i will be very thankful
    regards
    Asif

    Forms Listener Servlet is just another way of setting up forms on the web. The main difference is instead of the client and the Forms runtime talking directly, they do so via the webserver. This means thay you only need to have one port opened in your firewalls (e.g. 80) instead of two (80 and 9000)
    Please read the paper I indicated and this will hopefully explain it all.
    As to the suggestion of using the LOGON built int - this would be a solution but you will have to consider if this is acceptable if you have more that one user since the person running the application would have to identify themselves in some way.
    The other option is do not add the username and password in teh HTML and the default logon dialog will appear.
    Regards
    Grant Ronald
    Forms Product Management

  • How to run the paper layout & web layout?

    Hi,
    I have 10gR2 application server (Linux). A report was created in Reports 6i, now i opened the same in 10g and compiled in my local machine(development pc with windows xp).
    question 1
    In the development pc, i can run the paper layout but the same cant in web layout.
    1. How to run the weblayout?
    question 2
    Now my application is running in&as web enabled. A menu calling a report ,that i want to run as paper layout, is it possible in web enable mode? Otherwise i have to run as web layout.
    please guide me.
    Kanish

    Thanks for the advice.
    I am trying to run any iViews that connect to the R/3 back end.  I have read that you have to first connect to the SLD, and then set up the JCO connections.  Correct?
    I have got the SLD running, but I can't connect to it.  I have supplied the required SLD Data Supplier information in the Content Administrator. 
    In the Visual Administrator, under the SLD Data Supplier, I enter the Host, Port, User, and Password, but when I hit the Trigger Data button I get an error saying "Operation Failed!  Failed to collect SLD data.  Failed to send HTTP data: 401: Unauthorized.  Please check if the target SLD system is available and the SLD bridge is started there."
    Any help?

  • How to deploy XML schemas a web application?

    Hi,
    I have a couple of XML schemas in the project, which I want to import them into my BPEL using http url.
    How can I deloy XML schemas as a web application.
    Any inputs are appreciated.
    Thanks.
    ~V~

    You already asked this question:
    http://forum.java.sun.com/thread.jspa?threadID=5150005&messageID=9561597
    Obviously running notepad on the clients PC is not possible (ignoring active x)

  • How to run default transactions in WEB UI

    Hi all,
    Can somebody help me on how ti run the default WEb pages for transaction like BP, CRMD_ORDER . I am new to CRM 2007 and don't know where to find the htm pages to run. ( I guess URL should contain the server:prot_id/<directory> )
    Cheers
    Ravi

    Hi Ravi,
    I'm not sure, if I understood your question correctly, but if you want to view the new web ui, the following URL is what you're looking for:
    http://<host>:<port>/sap/bc/bsp/sap/crm_ui_frame/default.htm?sap-client=100&sap-sessioncmd=open
    Your user needs to be assigned to at least one business role (SAP_CRM_UIU*) to be able to access the corresponding workplace.
    For BSP applications the URL is:
    http://<host>:<port>/sap/bc/bsp/sap/crm_bsp_frame/select.htm
    Hope this helps.
    Kind regards,
    Martina

  • Problem when running the cookie WAR web application

              This relates to the cookie example mentioned in your "Web Application (WAR) examples" section. This is the example where a cookieWar.war is created and moved to the /weblogic/myserver directory. I followed the exact steps mentioned therein. but when I'm loading the "http://localhost:7001/cookie" I noticed that I'm getting the following excetion in the WebLogic console,
              Thu Sep 21 06:29:45 GMT+06:00 2000:<I> <RMI> Registry started Thu Sep 21 06:29:45 GMT+06:00 2000:<I> <EJB> 0 EJB jar files loaded, containing 0 EJBs Thu Sep 21 06:29:45 GMT+06:00 2000:<I> <EJB> 0 deployed, 0 failed to deploy. Thu Sep 21 06:29:49 GMT+06:00 2000:<E> <HTTP> Could not find Web application '/weblogic/myserver/cookieWar.war' java.io.FileNotFoundException: WEB-INF/web.xml XML file not found in jar file at weblogic.xml.dom.DOMParser.getDocument(DOMParser.java:93) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:132) at weblogic.t3.srvr.HttpServer.loadWARContext(HttpServer.java:583) at weblogic.t3.srvr.HttpServer.initServletContexts(HttpServer.java:559) at weblogic.t3.srvr.HttpServer.start(HttpServer.java:388) at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:1305) at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:827) at java.lang.reflect.Method.invoke(Native Method) at weblogic.Server.startServerDynamically(Server.java:99) at weblogic.Server.main(Server.java:65) at weblogic.Server.main(Server.java:55) at weblogic.NTServiceHelper.run(NTServiceHelper.java:19) at java.lang.Thread.run(Thread.java:484)
              Thu Sep 21 06:29:50 GMT+06:00 2000:<E> <HTTP> Error creating servlet context for Web application '/weblogic/myserver/cookieWar.war
              Please let me know how to overcome this problem
              

    Did you ever resolve this problem?  If so, I am experiencing the same problem.  Is it possible for you to share the solution? 
    Thank you.
    Jim

Maybe you are looking for

  • How to search for new AU in Logic Pro X?

    So I recently bought Nexus 2 so I can use it in Logic Pro X, and I made sure Nexus 2 is a 64bit plug in.  For some reason I can't seem to find it in my AU plug ins when I open up Logic Pro X, but I can find it in Logic Pro 9.  Can somebody help?

  • Unstable PXI/SCXI system

    I'm using a SCXI 1100 with a SCXI 1300 module to read the output of 6 instruments and a test signal. These are used in conjunction with a PXI-6040E module and is housed in a PXI-1011 chassis. The majority of the instruments are 4-20ma and a 120ohm re

  • Harman Kardon Soundsticks II 2.1 speakers

    Hi! It's my birthday soon and i want to get some speakers for my ipod. What i would like to know is do the speakers, Harman Kardon Soundsticks II 2.1 speakers, have to be plugged into a computer to be used? Can i just buy an ipod dock and plug that i

  • ITunes Match and Home Sharing

    My husband and I use Home Sharing, and we can access each other's music (purchased under our own Apple IDs). Does iTunes Match support Home Sharing or do we both need an annual subscription for iTunes Match?

  • Problems downloading CS5 on new laptop

    After buying a new laptop, an Apple support person helped me migrate all files from old MacBook Pro including CS5.  However, these Adobe files are corrupted and when trying to open Photoshop, I got this message: "Some of the application components ar