• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot print report please help.

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I run this code on jsp page
<%
String DocNo=request.getParameter("docno");
String Rev=request.getParameter("revno");

String tmpPath = "C:\\Program Files\\Crystal Decisions\\Crystal Reports 9\\Templates";

String rptPath = "C:\\Program Files\\Crystal Decisions\\Report Application Server 9\\Reports";

System.setProperty("ras.config", "C:\\Program Files\\Common Files\\Crystal Decisions\\2.0\\jars");

Fields fields = new Fields();

ParameterField pfield1 = new ParameterField();
ParameterField pfield2 = new ParameterField();

Values vals1 = new Values();
Values vals2 = new Values();

ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();
ParameterFieldDiscreteValue pfieldDV2 = new ParameterFieldDiscreteValue();

pfield1.setName("DocNo");
pfieldDV1.setValue(DocNo);

pfield2.setName("RevNo");
pfieldDV2.setValue(Rev);

vals1.add(pfieldDV1);
vals2.add(pfieldDV2);

pfield1.setCurrentValues(vals1);
pfield2.setCurrentValues(vals2);

fields.add(pfield1);
fields.add(pfield2);

ReportClientDocument cd2 = new ReportClientDocument();
cd2.open(rptPath + "\\" + "ShowSale.rpt", 0);

com.crystaldecisions.report.web.viewer.CrystalReportViewer tc1 = null;
tc1 = new com.crystaldecisions.report.web.viewer.CrystalReportViewer() ;
tc1.setReportSource(cd2.getReportSource());

tc1.setParameterFields(fields);
tc1.setEnableParameterPrompt(false);

tc1.setOwnForm(false);
tc1.setOwnPage(true);
tc1.setHasPrintButton(true);
tc1.setHasExportButton(false);
tc1.setDisplayGroupTree(false);
tc1.setHasViewList(false);
tc1.refresh();
tc1.processHttpRequest(request, response, getServletConfig().getServletContext(),pageContext.getOut());

tc1.dispose();
cd2.close();

%>

but when I press print or export or next page button I get this error
:[12/7/04 11:57:00:012 ICT] 34f8f37b SystemErr R java.lang.NullPointerException

I test by change a little bit code from

String DocNo=request.getParameter("docno");
String Rev=request.getParameter("revno");

to

String DocNo="00000001";
String Rev="001";

and it works!( But I have to receive parameter from user so I can not fix value of parameter )

What happen ?
How can I fix this problem ?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Check case sensitivity of doc and rev no in source and target pages.

You can also insert logs at the point these no. are entered to ensure your parameters are actually recieved by using something like System.out.println() at that stage.

u can also use javascript alert to log.

Hope this helps in removing NullPointerException

Sandeep Deshmukh
 
arada theera
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sandeep Deshmukh.I'll try like you told.
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic