Call .jrxml file from java or jsp
hello experts,
i want to know how to call or execute the .jrxml ie report file from the jsp or java
and how to pass the runtime query to the report?
urgnt
The below posts should answer your question
[http://forums.sun.com/thread.jspa?threadID=5203324&messageID=9811077]
[http://forums-beta.sun.com/thread.jspa?messageID=9857221]
On the same note please make an effort to search google about jasper API.
Similar Messages
-
Call .bat file from java code
I need to call an application that uses a .bat file to execute from a java program. Is that possible?
This is the .bat file:
importcli.exe ciaf2735 C:\Importcli\files\SAI2735*.txt
importcli.exe ciaf2735 C:\Importcli\files\CI2735*.txt
importcli.exe ciaf2735 C:\Importcli\files\SC2735*.txt
importcli.exe db1800 C:\Importcli\files\*.mdbmagaupe wrote:
I need to call an application that uses a .bat file to execute from a java program. Is that possible?
This is the .bat file:
importcli.exe ciaf2735 C:\Importcli\files\SAI2735*.txt
importcli.exe ciaf2735 C:\Importcli\files\CI2735*.txt
importcli.exe ciaf2735 C:\Importcli\files\SC2735*.txt
importcli.exe db1800 C:\Importcli\files\*.mdb
Hmmm, I wonder what would happen if there were a web search engine and you could research like this:
[http://www.google.com/search?hl=en&q=call+.bat+file+from+java] -
I wants to call .Exe file from Java Programme
I wants to call .Exe file from Java programme. Please give answer with example. This very urgent. Help me
hi
u can use Runtime.exec() method in java.lang package
to execute exe files
regards
pnp -
How to Call .XDO file From Java Program
Hi,
I have developed a report in using BI Publisher version 10.1.3.
I created the report and it only created XDO files. If I want to call XDO file from Java program how I can do that.
What are the APIs available to do that.
Thanks
-AshutoshHi,
the JavaAPI didn't work with the xdo-Files. But you can create a proxy stub for the Web Service API of BI Publisher which uses the xdo's in the repository.
regards
Rainer -
How to call external files from java?
How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?Jayarathina_Madharasan wrote:
no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
From JavaRanch :
And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
Edited by: Encephalopathic on Apr 14, 2008 10:01 AM -
Call .jrxml file from jsp
hi experts,
i created the jasper report file, and i want to call this file through the jsp.
plz help m.
i written the following code but it gives the error:
==code==
<%@ page import="java.sql.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.lang.Object" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="net.sf.jasperreport.engine.*" %>
<%@ page import="net.sf.jasperreport.engine.util.*" %>
<%@ page import="net.sf.jasperreport.engine.export.*" %>
<%@ page import="net.sf.jasperreports.engine.JasperCompileManager" %>
<%@ page import="net.sf.jasperreports.engine.design.JRMultiClassCompiler" %>
<%@ page import="net.sf.jasperreports.engine.JasperManager" %>
<%@ page import="net.sf.jasperreports.engine.xml.JRXmlLoader" %>
<%@ page import="net.sf.jasperreports.engine.JasperPrint" %>
<%@ page import="net.sf.jasperreports.engine.JasperFillManager" %>
<%@ page import="net.sf.jasperreports.engine.JasperExportManager" %>
<%@ page import="net.sf.jasperreport.engine.JREmptyDataSource" %>
<%@ page import="net.sf.jasperreports.engine.JasperReport" %>
<%@ page import="net.sf.jasperreports.engine.design.*" %>
<%@ page import="net.sf.jasperreports.view.JasperViewer" %>
<%@ page import="net.sf.jasperreports.engine.JRException" %>
<%
String reportSource ="C:/apache-tomcat-6.0.16/webapps/ROOT/Emp/report/sample.jrxml";
String reportDest = "C:/apache-tomcat-6.0.16/webapps/ROOT/Emp/report/sample.html";
Map params = new HashMap();
try
JasperDesign jasperDesign=JRXmlLoader.load(reportSource);
JasperManager.loadXmlDesign("sample.jrxml");
JasperReport jasperReport =JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint =JasperFillManager.fillReport(jasperReport, params, new JREmptyDataSource());
JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest);
JasperViewer.viewReport(jasperPrint);
catch (JRException ex)
ex.printStackTrace();
%>
==error==
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 31 in the jsp file: /Emp/report/rept.jsp
JREmptyDataSource cannot be resolved to a type
28: JasperDesign jasperDesign=JRXmlLoader.load(reportSource);
29: JasperManager.loadXmlDesign("sample.jrxml");
30: JasperReport jasperReport =JasperCompileManager.compileReport(jasperDesign);
31: JasperPrint jasperPrint =JasperFillManager.fillReport(jasperReport, params, new JREmptyDataSource());
32: JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest);
33: JasperViewer.viewReport(jasperPrint);
34: }
plz help m.Error log tells:
JREmptyDataSource cannot be resolved to a typeYou have missed "s" in package name. Instead of:
<%@ page import="net.sf.jasperreport.engine.JREmptyDataSource" %>do:
<%@ page import="net.sf.jasperreports.engine.JREmptyDataSource" %>Thanks,
Mrityunjoy -
Calling batch file from java Program
I have made the java program in which i have called the batch file.But the problem is this that when i call batch file locally it executes normally but when i try to execute batcvh file from remote machine it doesn't runrather it gives Runtime IO execption.Error123.Can anyone provide me the solution for this?
Not without a lot more information. Like for example how you are trying to execute this remote batch file, the code you are using to do that, what kind of server you have no the remote machine to let you remotely execute code, and so on.
-
heyy
can anybody please help me out in calling an exe file using java??
also i would like to pass parameters tooo.
i have been trying the following runtime code
but found no success
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("make.exe 12");
proc.waitFor();
int exitVal = proc.exitValue();
Does anybody havea better soultion???
Thanks for your time
RachitRead this article, please http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
-
How to call a function from Java to JSP
Hello,
I have a question about using tags.
I have a java file,which has a function. Now I want to call this function into my JSP page.
I'm using JSP 1.2 and TOMCAT 4.1 with Java2 SDK.
I search through the web and find a method to do this.Bu it requires JSP 2.0
But I try that in my machine(using JSP 1.2).It gives an error:
Did you know what is the error? Or is there any method to call a function into my JSP page?
Please, help me to solve this.
Here are my codes(part of them)
UserPassword.java file
package data;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
public static String verify(String username,String password){
// some codes
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>simple</short-name>
<uri>http://jakarta.apache.org/tomcat/HRM/WEB-INF/lib</uri>
<description>
A tab library for the login
</description>
<function>
<description>verify username and password</description>
<name>verify</name>
<function-class>data.UserPassword</function-class>
<function-signature>String verify(java.lang.String,java.lang.String)
</function-signature>
</function>
</taglib>I put this file into the webapps/HRM/WEB-INF/lib folder
Here is my JSP file.
<%@ page language="java" %>
<%@ page import="data.UserPassword" %>
<%@ page session="true" %>
<%@ taglib prefix="login" uri="/WEB-INF/lib/LoginVerify.tld" %>
<jsp:useBean id="useraccount" class="data.UserPassword"/>
<jsp:setProperty name="useraccount" property="*"/>
<%
String status = UserPassword.verify(String username,String password);
String nextPage = "MainForm.jsp";
if(status.equals("InvalidU")) nextPage ="InvalidUserName.jsp";
if(status.equals("InvalidP")) nextPage ="InvalidPassword.jsp";
if(status.equals("main")) nextPage ="MainForm.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>
Here is the error:
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/lib/LoginVerify.tld: (line 18, col -1): Element "taglib" does not allow "function" here.
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:189)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:247)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:183)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)Please, help me to solve this trouble.
Thanks.Yes. As serlank showed, you can just call the function easily in scriptlet tags
However the whole point of a tag library is to avoid the use of scriptlets.
Seeing as you can't use functions, is just to do it as a standard tag.
ie in your jsp
<login:verify name="<%= userName %>" password = "<%= password %>" resultVar = "status"/>
<c:choose>
<c:when test="${status == 'InvalidU'}">
<c:set var="nextPage" value="InvalidUserName.jsp"/>
</c:when>
<c:when test="${status == 'InvalidP'}">
<c:set var="nextPage" value="InvalidPassword.jsp"/>
</c:when>
</c:choose>In your case, this tag in the tld would possibly look something like this.
You would then have to write a tag handler class that would call the function you want.
<tag>
<name>verify</name>
<tagclass>com.tags.login.Verify</tagclass>
<teiclass>com.tags.login.VerifyTEI</teiclass> (if required)
<bodycontent>JSP</bodycontent>
// name attribute
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
// password attribute
<attribute>
<name>password</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
// result variable to return a response from the tag.
<variable>
<name-from-attribute >resultVar</name-from-attribute >
<variable-class>java.lang.String</variable-class>
<declare>true</declare>
<scope>AT_END</scope>
</variable>
</tag>Hope this helps some, and doesn't confuse too much :-)
Cheers,
evnafets -
Problem while calling PDF file from java
Hi,
In my Java standalone application i need show PDF files.
By using following code I can be able to show PDF files.
String theUrl=""//location of the
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + theUrl);
This is working fine with Acrobat 5, Acrobat 6 and Acrobat 7.
But problem with Adobe Acrobat 8
Cant be able to show PDF files using the above code.
Please help me to resolve to this issue.
Thanks & Regards
TKRI have the exact same problem as TKR. How do we fix the problem so ADOBE 8.1.2 will work for PDF files?
-
Invoking .SQL file from JAVA
Hi All,
Anyway of calling .SQL files from JAVA ??
thanks in advance..What do you mean by calling?
Are you talking about a stored procedure? Then yes.typo !!
i meant invoking .SQL script only...
No not stored procedure..i mean running or invoking a sql file containing sql statements(inserts etc) -
Calling javaFX script from Java program
I am trying to call JavaFX script from a simple Java program. code as follows:
import java.io.*;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class My{
public static void main(String[] args) {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByExtension("fx");
try {
InputStreamReader reader = new InputStreamReader(My.class.getResourceAsStream("first.fx"));
engine.eval(reader);
reader.close();
} catch (Exception e) {
e.printStackTrace();
my first.fx file code is here:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.text.TextAlignment;
Stage {
title: "My First JavaFX Sphere"
scene: Scene {
width: 250
height: 250
content: [
Text {
font: Font { size: 24 }
x: 20, y: 90
textAlignment: TextAlignment.CENTER
content:"Welcome to \nJavaFX World"
} //Text
] // content
} // Scene
} // Stage
I am not able to run My.java. runtime error as follows:
java.lang.NullpointerException
Kindly correct me, where I am wrongI am able to call .fx file from Java. Thank you all for helping me to resolve this problem
Regards,
Ritu -
How to call a .bat file from java code?
How to call a .bat file from java code? and how can i pass parameters to that .bat file?
Thanks in advancethanks for ur reply
but still i am getting the same error.
I am trying to run a .bat file of together tool, my code looks like below
import java.lang.Runtime;
import java.lang.Process;
import java.io.File;
class SysCall{
public static void main(String args[]){
String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
//String path="D://Borland//Together6.2//bin//Together.bat ";
Runtime r= Runtime.getRuntime(); //Declare the system call
try{
System.out.println("Before batch is called");
Process p=r.exec(cmd);
System.out.println(" Exit value =" + p.exitValue());
System.out.println("After batch is called");
/*can produce errors which must be caught*/
catch(Exception e) {
e.printStackTrace();
System.out.println (e.toString());
I am getting the below exception
Before batch is called
java.lang.IllegalThreadStateException: process has not exited
at java.lang.Win32Process.exitValue(Native Method)
at SysCall.main(SysCall.java:17)
java.lang.IllegalThreadStateException: process has not exited -
How can i call forpro prg file from java
Hai friends,
I have a doubt,clear it.
how can i call forpro prg file from java file
by,
N.VijayThanks to your reply,
I have some print statements in my foxpro program file.
Then i like to invoke that foxpro file from my java file
This want i want..,
by,
N.Vijay -
I need to call a batch file from java and pass arguments to that Batch file
Hi,
I need to call a batch file from java and pass arguments to that Batch file.
For example say: The batch file(test.bat) contains this command: mkdir
I need to pass the name of the directory to the batch file as an argument from My Java program.
Runtime.getRuntime().exec("cmd /c start test.bat");
How to pass argument to the .bat file from Java now ?
regards,
Krish
Edited by: Krish4Java on Oct 17, 2007 2:47 PMHi Turing,
I am able to pass the argument directly but unable to pass as a String.
For example:
Runtime.getRuntime().exec("cmd /c start test.bat sample ");
When I pass it as a value sample, I am able to receive this value sample in the batch file. Do you know how to pass a String ?
String s1="sample";
Runtime.getRuntime().exec("cmd /c start test.bat s1 ");
s1 gets passed here instead of value sample to the batch file.
Pls let me know if you have a solution.
Thanks,
Krish
Maybe you are looking for
-
Mac iTunes won't sync to iPhone/iPad for voice memos
I got my voice memo from iPhone into mac iTunes music list. Now it won't sync back updating iPhone iTunes with it even though i have checked include voice memos. Same with iPad. Help???
-
I am new to weblogic server. l want to know about ldap, why it is used?. is it possible to configure ldap with security realms?. I want to know the procedure.
-
Can I upgrade 10 R1 to R2, or need reinstall ?
Hi all, We are running Oracle 10.1.0.3.0, to upgrade to 10.2.0.1.0, can we just run upgrade patch, or we have to reinstall the database from scratch ? Thank you, xtanto
-
Where can I get pcie x1 tv tuner card drivers for my HP Compaq 6005 Pro series SFF desktop Windows 7 Thanks for any help
-
.Mac Alias "From field"
I really like the idea of having aliases they keep you main account protected from all sorts of evil. But i have a question concerning sending mail with one of your aliases as the sender. When i send an email the "from" field of that email displays t