Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

muhammad fahim

Ranch Hand
+ Follow
since Dec 17, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by muhammad fahim

sir i use jasperviewer and get right result but only in server browser
when i use my in client browser then jasperviewer open in server browser
not open in client browser

some body i use inputstreem
but sir i not have any idea of inputstreem how i opasss through streem to client browser

please give me idea how i use inputstreem in jsp page

thank's


aamir
hi master
sir i wnat open jasperviewer at client side

i serach in net then i found many tip
one friend give me idea i create

class and call through button





but sir how i call this class from jsp button
when i press button call this class

please give me idea

thank's


aamir

[ July 14, 2007: Message edited by: Bear Bibeault ]



[BSouther: Added UBB CODE tags]
[ July 15, 2007: Message edited by: Ben Souther ]
14 years ago
JSP
hi master
sir i am use sun java studio creater
please guid me how i use streem for jasperviewer

my need is how i open jasperviewer in client computer
i test in my server side and get right result

please send me code

thank's

aamir
14 years ago
hi Joel McNary
thank's for your reply

dear please guid me how i use stream for JasperPrint
please send me sample code

thank's

aamir
Hi master
Sir I success to create to p6df file and call mfa.jasper file in this code
JasperViewer.viewReport(jasperPrint,false);

See my full code for calling mfa.jasper and createin pdf

Connection conn = null ;
Statement msqlStatement = null ;
ResultSet mrs = null ;
Connection mconn = null ;
try {
String mfat = accbalDataProvider.getCachedRowSet().getDataSourceName();
javax.naming.Context mctx = new javax.naming.InitialContext() ;
DataSource mds = (DataSource)mctx.lookup(mfat);
Connection mcon= mds.getConnection();
mcon.setAutoCommit(false) ;
JasperPrint jasperPrint = JasperManager.fillReport("C:/Mfa.jasper",null,mcon);
JasperManager.printReportToPdfFile(jasperPrint, "c:/fahimaami.pdf");
} catch (Exception ex) {
log(" Error Description" , ex);
error("Error counting rows: " + ex.getMessage() );
error("Error counting rows: " + ex );
}

sir my first question
1.I create the pdf file but not show how I show pdf file

Question no. 2 .

sir this code calling mfa.jasper and createin pdf only in sever not show mfa.jasper in client side i call this page in inter net or office network or local network
I use this link

http://fahim:29080/WebApplication15/

that link run my page when I press button then page create the c:/fahimaami.pdf in server c: drive not create client c: drive or create server side not create client side

and open JasperViewer.viewReport(jasperPrint,false); file in server side not onpen mfa.jasper file in client side

please give me idea how I open mfa.jasper in client side or client computer

thank�s

aamir
hi master
sir i try to call create pdf in my project when i complied that system not give me error but when i press button where i write my code and see in view server log that give me this error



[#|2007-07-01T13:51:10.515+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=11;|ADM1042tatus of dynamic reconfiguration event processing:[runtime_error]|#]
[#|2007-07-01T13:51:10.579+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=12;|ADM1041ent the event to instance:[ApplicationDeployEvent -- reference-removed WebApplication17]|#]
[#|2007-07-01T13:51:10.658+0500|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=12;|ADM1042tatus of dynamic reconfiguration event processing:[success]|#]
[#|2007-07-01T13:51:11.391+0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.sys tem.core.classloading|_ThreadID=13;|LDR5203: An error occurred while adding URL [file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j.jar] to the EJB class loader. Please check the content of this URL. |#]
[#|2007-07-01T13:51:11.391+0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.sys tem.core.classloading|_ThreadID=13;|LDR5200:MalformedURLException.
java.io.IOException




main error is

[#|2007-07-01T13:51:11.391+0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.sys tem.core.classloading|_ThreadID=13;
|LDR5203: An error occurred while adding URL
[file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j.jar] to the EJB class loader. Please check the content of this URL. |#]

why ejb giv me error and whe log4j.jar give me error that not support to jsp

please give me idea how i solve this error

thank's

aamiir
Sir I use sun java studio creater with oracle and call pdf through jaserreport or irepor
When I run my project then system not give me pdf report

Sir I see server view log file that in last line give this error


[#|2007-06-16T15:22:44.761+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17] ********* Error compiling report: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.|#]


please give idea how I solve this error


thank�s

aamir
[ June 16, 2007: Message edited by: Bear Bibeault ]
14 years ago
JSP
Hi master
Sir I use oracle with sun java studio creater and designed the report in ireport and test that give right result in ireport preview

Sir I use this code in studio creater

These file I import
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.rave.web.ui.component.Body;
import com.sun.rave.web.ui.component.Form;
import com.sun.rave.web.ui.component.Head;
import com.sun.rave.web.ui.component.Html;
import com.sun.rave.web.ui.component.Link;
import com.sun.rave.web.ui.component.Page;
import javax.faces.FacesException;
import com.sun.rave.web.ui.component.Button;
import java.sql.*;
import javax.sql.DataSource;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.design.*;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.JasperPrintManager;


this code I use

public String button1_action() {
Connection conn = null ;
log("*********** connecting");
try {
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/datasource1" ) ;
conn = ds.getConnection() ;
} catch (Exception ex) {
error(" Error counting rows: " + ex.getMessage() );
log(" Error counting rows: " + ex.getMessage() );
}

JasperReport jasperReport;
JasperPrint jasperPrint;

log("compiling report");
try {

//jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");
jasperReport = JasperCompileManager.compileReport("./report/mfa.jasper");

} catch (Exception ex) {
log(" ********* Error compiling report: " + ex.getMessage() );
}
return null;
}
}



but sir when I run project and press button the page not give me resutlt


then I check in server view log file that give me this detail





Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j-core.jar
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at com.sun.enterprise.loader.EJBClassLoader$URLEntry.init(EJBClassLoader.java:848)
... 16 more
|#]
[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|DPL5109: EJBC - START of EJBC for [WebApplication17]|#]
[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|Processing beans ...|#]
[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|DPL5110: EJBC - END of EJBC for [WebApplication17]|#]
[#|2007-06-16T12:44:13.256+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|Total Deployment Time: 547 msec, Total EJB Compiler Module Time: 15 msec, Portion spent EJB Compiling: 2%
Breakdown of EJBC Module Time: Total Time for EJBC: 15 msec, CMP Generation: 0 msec (0%), Java Compilation: 0 msec (0%), RMI Compilation: 0 msec (0%), JAX-RPC Generation: 0 msec (0%),
|#]
[#|2007-06-16T12:44:13.334+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|deployed with moduleid = WebApplication17|#]
[#|2007-06-16T12:44:13.522+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=15;|ADM1041:Sent the event to instance:[ApplicationDeployEvent -- reference-added WebApplication17]|#]
[#|2007-06-16T12:44:13.553+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=15;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]
[#|2007-06-16T12:44:13.584+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=14;|ADM1041:Sent the event to instance:[ModuleDeployEvent -- deploy web/WebApplication17]|#]
[#|2007-06-16T12:44:13.615+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=14;|WEB0100: Loading web module [WebApplication17] in virtual server [server] at [/WebApplication17]|#]
[#|2007-06-16T12:44:14.787+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.beanutils.MethodUtils|_ThreadID=14;|Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.|#]
[#|2007-06-16T12:44:15.022+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.digester.Digester|_ThreadID=14;|[ComponentRule]{faces-config/component} Merge(com.sun.rave.web.ui.Time)|#]
[#|2007-06-16T12:44:15.178+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.digester.Digester|_ThreadID=14;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigDecimal)|#]
[#|2007-06-16T12:44:15.178+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.digester.Digester|_ThreadID=14;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigInteger)|#]
[#|2007-06-16T12:44:16.131+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=14;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]
[#|2007-06-16T12:46:41.720+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17]*********** connecting|#]
[#|2007-06-16T12:46:41.751+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17] Error counting rows: null|#]
[#|2007-06-16T12:46:41.751+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17]compiling report|#]
[#|2007-06-16T12:46:41.767+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17] ********* Error compiling report: java.io.FileNotFoundException: .\report\mfa.jasper (The system cannot find the path specified)|#]
[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17]*********** connecting|#]
[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17] Error counting rows: null|#]
[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17]compiling report|#]
[#|2007-06-16T12:51:56.984+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17] ********* Error compiling report: java.io.FileNotFoundException: .\rep





Main error is

Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j-core.jar


Please give me idea how I get call pdf report

Thank�s

aamir
[ June 16, 2007: Message edited by: Bear Bibeault ]
14 years ago
JSP
Hi master
Sir I use oracle with sun java studio creater and designed the report in ireport and test that give right result in ireport preview

Sir I use this code in studio creater

These file I import
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.rave.web.ui.component.Body;
import com.sun.rave.web.ui.component.Form;
import com.sun.rave.web.ui.component.Head;
import com.sun.rave.web.ui.component.Html;
import com.sun.rave.web.ui.component.Link;
import com.sun.rave.web.ui.component.Page;
import javax.faces.FacesException;
import com.sun.rave.web.ui.component.Button;
import java.sql.*;
import javax.sql.DataSource;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.design.*;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.JasperPrintManager;


this code I use

public String button1_action() {
Connection conn = null ;
log("*********** connecting");
try {
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/datasource1" ) ;
conn = ds.getConnection() ;
} catch (Exception ex) {
error(" Error counting rows: " + ex.getMessage() );
log(" Error counting rows: " + ex.getMessage() );
}

JasperReport jasperReport;
JasperPrint jasperPrint;

log("compiling report");
try {

//jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");
jasperReport = JasperCompileManager.compileReport("./report/mfa.jasper");

} catch (Exception ex) {
log(" ********* Error compiling report: " + ex.getMessage() );
}
return null;
}
}



but sir when I run project and press button the page not give me resutlt


then I check in server view log file that give me this detail





Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j-core.jar
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at com.sun.enterprise.loader.EJBClassLoader$URLEntry.init(EJBClassLoader.java:848)
... 16 more
|#]
[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|DPL5109: EJBC - START of EJBC for [WebApplication17]|#]
[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|Processing beans ...|#]
[#|2007-06-16T12:44:13.069+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|DPL5110: EJBC - END of EJBC for [WebApplication17]|#]
[#|2007-06-16T12:44:13.256+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|Total Deployment Time: 547 msec, Total EJB Compiler Module Time: 15 msec, Portion spent EJB Compiling: 2%
Breakdown of EJBC Module Time: Total Time for EJBC: 15 msec, CMP Generation: 0 msec (0%), Java Compilation: 0 msec (0%), RMI Compilation: 0 msec (0%), JAX-RPC Generation: 0 msec (0%),
|#]
[#|2007-06-16T12:44:13.334+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=19;|deployed with moduleid = WebApplication17|#]
[#|2007-06-16T12:44:13.522+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=15;|ADM1041:Sent the event to instance:[ApplicationDeployEvent -- reference-added WebApplication17]|#]
[#|2007-06-16T12:44:13.553+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=15;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]
[#|2007-06-16T12:44:13.584+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=14;|ADM1041:Sent the event to instance:[ModuleDeployEvent -- deploy web/WebApplication17]|#]
[#|2007-06-16T12:44:13.615+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=14;|WEB0100: Loading web module [WebApplication17] in virtual server [server] at [/WebApplication17]|#]
[#|2007-06-16T12:44:14.787+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.beanutils.MethodUtils|_ThreadID=14;|Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.|#]
[#|2007-06-16T12:44:15.022+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.digester.Digester|_ThreadID=14;|[ComponentRule]{faces-config/component} Merge(com.sun.rave.web.ui.Time)|#]
[#|2007-06-16T12:44:15.178+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.digester.Digester|_ThreadID=14;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigDecimal)|#]
[#|2007-06-16T12:44:15.178+0500|WARNING|sun-appserver-pe8.2|org.apache.commons.digester.Digester|_ThreadID=14;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigInteger)|#]
[#|2007-06-16T12:44:16.131+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.admin|_ThreadID=14;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]
[#|2007-06-16T12:46:41.720+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17]*********** connecting|#]
[#|2007-06-16T12:46:41.751+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17] Error counting rows: null|#]
[#|2007-06-16T12:46:41.751+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17]compiling report|#]
[#|2007-06-16T12:46:41.767+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=20;|WebModule[/WebApplication17] ********* Error compiling report: java.io.FileNotFoundException: .\report\mfa.jasper (The system cannot find the path specified)|#]
[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17]*********** connecting|#]
[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17] Error counting rows: null|#]
[#|2007-06-16T12:51:56.968+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17]compiling report|#]
[#|2007-06-16T12:51:56.984+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=21;|WebModule[/WebApplication17] ********* Error compiling report: java.io.FileNotFoundException: .\rep





Main error is

Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication17/build/web/WEB-INF/lib/log4j-core.jar


Please give me idea how I get call pdf report

Thank�s

aamir
14 years ago
sir i try call the jasper report but system give me this error


Caused by: java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/Administrator/My Documents/Creator/Projects/WebApplication15/build/web/WEB-INF/lib/log4j-core.jar
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at com.sun.enterprise.loader.EJBClassLoader$URLEntry.init(EJBClassLoader.java:848)
... 16 more
|#]
[#|2007-06-15T12:55:53.587+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=17;|DPL5109: EJBC - START of EJBC for [WebApplication15]|#]
[#|2007-06-15T12:55:53.587+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=17;|Processing beans ...|#]
[#|2007-06-15T12:55:53.587+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=17;|DPL5110: EJBC - END of EJBC for [WebApplication15]|#]
[#|2007-06-15T12:55:53.697+0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.tools.deployment|_ThreadID=17;|Total Deployment Time: 438 msec, Total EJB Compiler Module Time: 0 msec, Portion spent EJB Compiling: 0%
Breakdown of EJBC Module Time: Total Time for EJBC: 0 msec, CMP Generation: 0 msec (0%), Java Compilation: 0 msec (0%), RMI Compilation: 0 msec (0%), JAX-RPC Generation: 0 msec (0%),


please give me idea how i get result

thank's
aamir
14 years ago
Sir I am use datasource and resultset with this code this code not give me error

Sir I use one button and one text box that name is m1 I try move resultset value into mt my textbox but resultnot give me data


My code


public String button1_action() {
Connection conn = null ;
Statement sqlStatement = null ;
ResultSet rs = null ;
try {
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Travel") ;
conn = ds.getConnection() ;
// setup the connection
conn.setAutoCommit(false) ;
// execute the query
sqlStatement = conn.createStatement() ;
rs = sqlStatement.executeQuery("select count(*) from TRIP" ) ;
rs.next() ;
int rows = rs.getInt(1) ;
m1.setValue(Integer.toString(rows));
conn.commit() ;
info("Rows in table TRIP: " + Integer.toString(rows)) ;
}

catch (Exception ex) {
error("Error counting rows: " + ex.getMessage() );
}
return null;
}


please give me idea how I get data in textbox form result
14 years ago
mr. Sandeep Chhabra

i flow to your give step


see my code

public String button2_action() {

JasperDesign jasperDesign = JasperManager.loadXmlDesign("f:/ireport/fahim.jrxml");

JasperReport jasperReport = JasperManager.compileReport(jasperDesign);

Map parameters = new HashMap();

parameters.put("pid", new Integer(19));

Connection conn = null ;
try {
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/Travel" ) ;
conn = ds.getConnection() ;
} catch (Exception ex) {
error(" Error counting rows: " + ex.getMessage() );
}

JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,parameters,conn);

JasperManager.printReportToPdfFile(jasperPrint, "BasicReport.pdf");
return null;
}
}



it only give me light green line where i use JasperManager word not error line

i import this file

import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.design.*;

import java.util.*;


import java.sql.*;
import java.util.HashMap;
import java.util.Map;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.view.JasperViewer;
//import net.sf.jasperreports.engine.JasperManager;
import net.sf.jasperreports.engine.JasperPrintManager;



and when i build my project then system give me error in output windows


============see my all error


Compiling 3 source files to C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\build\web\WEB-INF\classes
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:306: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown


JasperDesign jasperDesign = JasperManager.loadXmlDesign("f:/ireport/fahim.jrxml");


C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:307: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown

JasperReport jasperReport = JasperManager.compileReport(jasperDesign);

C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:318: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown


JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,parameters,conn);


C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:319: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown


JasperManager.printReportToPdfFile(jasperPrint, "BasicReport.pdf");

Note: C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java uses or overrides a deprecated API.
Note: Recompile with -Xlint eprecation for details.

4 errors
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\nbproject\build-impl.xml:233: The following error occurred while executing this line:
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\nbproject\build-impl.xml:122: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)






please give me idea how i create pdf file

thank's

aamir
Hi master sir I flow your guidance but when I give complied file name that give me error on that line

See my code


Connection conn = null ;
try {
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/Travel" ) ;
conn = ds.getConnection() ;
} catch (Exception ex) {
error(" Error counting rows: " + ex.getMessage() );
}


JasperReport jasperReport;
JasperPrint jasperPrint;



jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");


sir what wrong with this code

jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");

sir this line give me error


sir please give idea how I create pdf give all remaining step after this error line

thank�s

amir
14 years ago
Hi master sir I flow your guidance but when I give complied file name that give me error on that line

See my code


Connection conn = null ;
try {
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/Travel" ) ;
conn = ds.getConnection() ;
} catch (Exception ex) {
error(" Error counting rows: " + ex.getMessage() );
}


JasperReport jasperReport;
JasperPrint jasperPrint;



jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");


sir what wrong with this code

jasperReport = JasperCompileManager.compileReport("c:/fahimjasper/fahim.jasper");

sir this line give me error


sir please give idea how I create pdf give all remaining step after this error line

thank�s

amir
14 years ago
sir i use under blow code for geting datasource

no error in datasource but when use datasource object that give me errr

Connection conn = null ;
// the following should be in a try-catch...
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Travel") ;
conn = ds.getConnection() ;

JasperReport jasperReport = JasperCompileManager.compileReport ("f:\ireport\fahim.jrxml","G",conn); ?(this line give me error )

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,new HashMap(),obj);


please give me idea how i get ireport JasperReport viewer

thank's

aamir
14 years ago