Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

karthik swamy

Ranch Hand
+ Follow
since Mar 14, 2011
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
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by karthik swamy

I am running this code through command in jboss server.
I compiled using javac -cp $CLASSPATH: and then the lib path and class also got compiled without any error but still it gives the same error.
So please hekp me out
4 years ago

I am getting subjected error even if there is class file present so please help me out of this ..

following is my java code :

package   pkh.kky;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Date;

public class PDFWriter{

   /**
    * @param args
    */
   public static void main(String[] args) {
       try {
           File file = new File("/home/hdfc/jboss-eap-6.4/standalone/deployments/ICM_UNB.war/WEB-INF/classes/interchange/dataobject/itext.pdf");
           FileOutputStream pdfFileout = new FileOutputStream(file);
           Document doc = new Document();
           PdfWriter.getInstance(doc, pdfFileout);

           doc.addAuthor("QuicklyJava.com");
           doc.addTitle("This is title");
           doc.open();

           Paragraph para1 = new Paragraph();
           para1.add("This is paragraph 1");

           Paragraph para2 = new Paragraph();
           para2.add("This is paragraph 2");

           doc.add(para1);
           doc.add(para2);

           doc.close();
           pdfFileout.close();

           System.out.println("Success!");
       } catch (Exception e) {
           e.printStackTrace();
       }
   }

}
4 years ago
Dear All,

Please clarify me, when I used to upload file then it won't upload as I rectified due to jboss user password expiration it is not allowing to upload.
So please tell me how can we catch this type of exception and shown to end user that password of server user is expired.

Thanks & Regards,
Karthik G.
4 years ago
Iused jasperreports-5.1.0.jar to generate jrxml file and put the same jar file in WEb-INF folder of .war file and it got compiled also and as per above instruction i changed the language to java but it throws the same error...
and I am littlt bit confuse in the statement " The jar file version needs to match the Jasper (client) version." As I am new to this tell me what is Jasper (client) version.


Regards,
Karthik G.
Hi All,

Here is my JRXML code :



<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"; name="C1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3835481c-be85-4ed0-89fa-25b226d4711f">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="137"/>
<parameter name="custTitle" class="java.lang.String"/>
<parameter name="custFullname" class="java.lang.String"/>
<parameter name="address1" class="java.lang.String"/>
<parameter name="address2" class="java.lang.String"/>
<parameter name="address3" class="java.lang.String"/>
<parameter name="custCity" class="java.lang.String"/>
<parameter name="pinCode" class="java.lang.String"/>
<parameter name="amount" class="java.lang.String"/>
<parameter name="SRDate" class="java.lang.String"/>
<parameter name="SRNumber" class="java.lang.String"/>
<parameter name="cardNumber" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="661" splitType="Stretch">
<staticText>
<reportElement uuid="7d0bb114-b36e-441a-9c8b-86d4fe7a5936" x="0" y="0" width="555" height="160"/>
<textElement/>
<text><![CDATA[
...................................................
..........................
...............
</jasperReport>


and this is how i am generating report using code :


JasperReport jasperReport = null;
JasperDesign jasperDesign = null;
Map parameters = new HashMap();
parameters.put("custTitle","Mr.");
parameters.put("custFullname","ABC");
parameters.put("address1","DEF");
parameters.put("address2","XYZ");
parameters.put("address3","POIU");
parameters.put("custCity","Asdf");
String path = getServletContext().getRealPath("/WEB-INF/");
jasperDesign = JRXmlLoader.load("path of jrxml file//C1.jrxml");

jasperReport = JasperCompileManager.compileReport(jasperDesign);
byte[] byteStream = JasperRunManager.runReportToPdf(jasperReport, parameters, conn);
// byte[] byteStream = JasperRunManager.runReportToPdf(jasperReport, parameters);
OutputStream outStream = response.getOutputStream();
response.setHeader("Content-Disposition","inline, filename=myReport.pdf");
response.setContentType("application/pdf");
response.setContentLength(byteStream.length);
outStream.write(byteStream,0,byteStream.length);



it is compiling fine and while generating through iReport also it is getting generated
but while generating through front end it showing me error :

ERROR [Digester] Parse Error at line 2 column 447: Document root element "jasperReport", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "jasperReport", must match DOCTYPE root "null".

I searched in many forums also but it showing version might be different then i compiled with same version also but then also it shows the same error, so please help me out of this....
Please tell me where i am wrong...


Thanks in Advance,
Karthik G.














Shripad Katkamwar wrote:Hi karthik,
You need to just add one variable to your action class whose name should be as same as radio button's name and also its getter and setter.
Thats it.You will get a value of radio button.
Thank you..



Thank You,Shripad it works.
6 years ago

struts code :


<s:iterator value="#cList" status="stat">
<s:if test="#stat.first==true">
<td align="center"><input type="radio" name="rType" checked value='<s:property />'/> </td>
</s:if>
<td><s:property /></td>
</s:iterator>

-- i need to pass radio value to these action,so please help me out of this...

function ProcessSubmit(){

document.getElementById('actionframe').src="./GetRecordList.action";
/*
document.frmProcess.action="./GetRecordList.action";*/
document.frmProcess.submit();
}



Thanks in Advance,
Karthik G.
6 years ago
Hi All,
Following is my xml read and display code:

package com.mycompany.xmlread;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class App
{
public static void main( String[] args )
{
try {

SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();

DefaultHandler handler = new DefaultHandler() {

boolean jname = false;
boolean con = false;
boolean driverName = false;
boolean username = false;
boolean password = false;

@Override
public void startElement(String uri, String localName,String qName,
Attributes attributes) throws SAXException {

//System.out.println("Start Element :" + qName);

if (qName.equalsIgnoreCase("jndi-name")) {
jname = true;
}

if (qName.equalsIgnoreCase("connection-url")) {
con = true;
}

if (qName.equalsIgnoreCase("driver-class")) {
driverName = true;
}

if (qName.equalsIgnoreCase("user-name")) {
username = true;
}
if (qName.equalsIgnoreCase("password")) {
password = true;
}
}

@Override
public void endElement(String uri, String localName,
String qName) throws SAXException {

//System.out.println("End Element :" + qName);

}

@Override
public void characters(char ch[], int start, int length) throws SAXException {
String str=new String(ch, start, length);
if(str.equals("abc")){
/*
Made all boolean values false;

*/

}
if (jname) {
System.out.println("JNDI Name : " +str );
jname = false;
}

if (con) {
System.out.println("Connection URL : " +str);
con = false;
}

if (driverName) {
System.out.println("Driver Name : " +str);
driverName = false;
}

if (username) {
System.out.println("Username : " + str);
username = false;
}
if (password) {
System.out.println("Password : " +str);
password = false;
}
}

};

saxParser.parse("D:\\test.xml", handler);

} catch (Exception e) {
e.printStackTrace();
}
}

}

XML file:

<?xml version='1.0' encoding='us-ascii'?>

<datasources>
<local-tx-datasource>
<jndi-name>abc</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/jboss</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>abc1</user-name>
<password>1234</password>
</local-tx-datasource>

<local-tx-datasource>
<jndi-name>xyz</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/jboss</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>xyz1</user-name>
<password>jan2010</password>
</local-tx-datasource>
</datasources>

I need to display only those values which comes under tag name : <jndi-name>xyz<jndi-name>
But still it prints all the values of xml file.So please help me out how can i put the check.


Thank In Advance,
Karthik G.
Hi All,

I am using Servlet fileupload.
I have imported all the jar files but still the request can't be parsed.
I have also mentioned enctype attribute of form tag.

Here is the sample code


in next jsp page


here is the code (Dont worry about the library files everything has been included).

I am running the code in JBOSS Server.
Is there any server configuration affecting the code. Because earlier the code was running properly.

Any help is highly appreciated.

7 years ago
JSP
Hi all,

please help me out of this...

in front end when i click on this button its not working but i also specify form name but then also it is not working giving error so how should i use the calender to make it work properly....

<html:form action="/amex/AmexRollBack" method="post">

<table class=TableBorder align=center cellspacing=0 cellpadding=0>
<tr><th class="Head" colspan="6" >Amex RollBack</th>
</tr>
<TR>
<TD colspan=2 class=Lable align=center><bean:message key="amex.fromDate"/><br></TD>
<td>
<html:text property="startDate1" value="" />
<IMG align=absMiddle border=0 height=16 src="./Calender/calendar.gif" width=16 onClick = 'openCalendar(document.getElementById("startDate1"))'>
</td>
<TD colspan=2 class=Lable align=center><bean:message key="amex.toDate"/><br></TD>
<td><html:text property="toDate1" value="" /></td>
</TR>
<tr><td></td>
<td colspan=2 align=center>
<html:submit property="method">
<bean:message key="button.Search" />
</html:submit></td><td></td>
<td colspan=2 align=center>
<html:submit property="method">
<bean:message key="button.Process"/>
</html:submit>
</td>
</tr>
</table>
</html:form>


Thanks in advance,
Karthik G
7 years ago
hi Everybody,

here is my code so please help me...



while clicking on hyperlink the script function doesn't get execute... so please provide me the solution...

Thanks & Regards,
Karthik Swamy.
Hello Everyone,
here is my code .... please help me out of this...



String strQuery=sqlQuery;
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(strQuery);
ResultSetMetaData metaData=rs.getMetaData();
int colCount =metaData.getColumnCount();
for(int i=1;i<=rowCount;i++){
System.out.print(metaData.getColumnName(i).format("%"+metaData.getColumnDisplaySize(i)+"s",metaData.getColumnName(i)).replace(" "," "));

}

and showing me the above error.


thanks,
karthik swamy
hello everyone,
just view this SQL queryi.e
This is what i am getting from database :

then in jsp I am replacing like this :

then the query looks like this :

then i am binding it with prepareStatement

if i need to set String only for org_id then it works

but if then query comes like this:

then code the java code fails to work...

so please suggest me any solutions for this...



Thanks and regards,
Karthik Swamy
How do i get pubring.pkr for encryption of file in PGP also i want to know how i will decrypt the PGP encrypted File.???
here is my code what is wrong in it???
8 years ago

Sudheer Bhat wrote:Your code is not right. You are setting a string literal to the query in list where as DB expects the in list to be numbers.

The query which gets exected in your case will look like

Make sure your query gets constructed as

Where 1, 2 and 3 are numerical values (assuming org_id is of type number in the DB).



But Sir i am getting that id as 1','2','3 and after that i am just appending ' at front and end and passing as String to DB then why it is not working.
i mean SELECT ...... FROM table where something in ('1','2','3');
like this i need to pass.
so please suggest any solution.