evan theon

Ranch Hand
+ Follow
since Feb 16, 2005
Merit badge: grant badges
For More
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 evan theon

i'm receiving this as the error message :



Caught a remote exception: RemoteException occurred in server thread; nested exception is:

java.rmi.RemoteException: Unable to Connect.Error in allocating a connection. Cause: org.postgresql.Driver

>Did you test the connectivity between the database machine and app server machine? -> where can i start doing this? by ping? i already ping between the DB machine and the App server machine and it is connected. or is there something else i need to do? in addition, the DB machine is red hat linux and the app server is win2000.

yes i'm building a datasource for my purpose. for additional information, if we use netbeans IDE 4.1, there is a window in which we can configure a connection and connect directly to a database, and i have configure it from that window and i can see the tables,records,etc from the database as the result. i can assume that as a succesful connection, can't i?

by the way i really like the way your guiding me with your posting, it's enlighting i can see your point clearly. i really need this since i'm a newbie. thanks a lot
i'm designing an enterprise application using an EJB module and an EJB Client, i'm using SJSAS as my application server and POstgreSQL as my DBMS, and netbeans 1.4 as my tool. i'm having trouble connecting to the remote DB server (PostgreSQL). is there anyone here have experience in using netbeans and come up with the same issue with me? if there is, i will continue my posting

thanks for everyone
oops...i forgot to mentioned that my problem is how to pass the ArrayList object to my print method i used ( which i have wrote on my last posting ) once i can get the Arraylist read inside my print method, the next step step would be more simple.
i've tried to do this in my sub class' constructor :

private class IntroPage(ArrayList) implements Printable

as you can see in my coding (on the last posting) i use this IntroPage class to do the printing job and design the result. but when i change its declaration (adding a parameter to it) it doesn't work!
the error message was that i need to add a "("
which i assumed i already did. is there any rules on printing in Java that i missed??

thanks for your help i really appreciate it
18 years ago
i have just learned how to print a text ( not a text file ) in Java, and i also have just learned how to make a program with GUI using AWT and SWING ( i understand only a little bit of those two techniques, just adequate for me to make my program works ).
now what i'm trying to do is to make a GUI program that prints an ArrayList's contents when i push a 'PRINT' button.
the bottomline of my case is that i need to know how to make a print method with an ArrayList parameter which contents is going to be print.
let me simplify more :
say i have this program i used to print
import java.awt.*;

import java.awt.font.*;

import java.awt.geom.*;

import java.awt.print.*;





public class PrintInvoice {



private final static int POINTS_PER_CM = 29;



public PrintInvoice () {



PrinterJob printJob = PrinterJob.getPrinterJob ();



Book book = new Book ();



PageFormat documentPageFormat = new PageFormat ();

documentPageFormat = printJob.pageDialog(documentPageFormat);

for(int j=0; j<10; j++)

book.append (new IntroPage (), documentPageFormat);





printJob.setPageable (book);



if (printJob.printDialog()) {

try {

printJob.print();

} catch (Exception PrintException) {

PrintException.printStackTrace();

}

}



}



static public void main(String args[])

{

PrintInvoice ex = new PrintInvoice();

}



private class IntroPage implements Printable {





public int print (Graphics g, PageFormat pageFormat, int page) {



Graphics2D g2d = (Graphics2D) g;



g2d.translate (pageFormat.getImageableX (), pageFormat.getImageableY ());



g2d.setPaint (Color.black);



Font titleFont = new Font ("Times New Roman", Font.BOLD, 14);

g2d.setFont (titleFont);

g2d.drawString ("text1", (int)(17.5*POINTS_PER_CM), (int)(2*POINTS_PER_CM));



titleFont = new Font ("Times New Roman", Font.PLAIN, 11);

g2d.setFont (titleFont);



g2d.drawString ("text2", (int)(2.5*POINTS_PER_CM), (int)(2.6*POINTS_PER_CM));

g2d.drawString ("text3", (int)(2.5*POINTS_PER_CM), (int)(3.1*POINTS_PER_CM));



titleFont = new Font ("Times New Roman", Font.PLAIN, 10);

g2d.setFont (titleFont);

for (int i = (6*POINTS_PER_CM); i < (int)(11.5*POINTS_PER_CM); i += 14) {

g2d.drawString ("texta", (int)(1*POINTS_PER_CM), i);

g2d.drawString ("textb", (int)(1.9*POINTS_PER_CM), i);

g2d.drawString ("textc", (int)(2.9*POINTS_PER_CM), i);

}

titleFont = new Font ("Times New Roman", Font.PLAIN, 11);

g2d.setFont (titleFont);

g2d.drawString ("text4", (int)(18.5*POINTS_PER_CM), (int)(12.2*POINTS_PER_CM));

g2d.drawString ("text5", (int)(18.5*POINTS_PER_CM), (int)(12.7*POINTS_PER_CM));

g2d.drawString ("text6", (int)(18.5*POINTS_PER_CM), (int)(13.2*POINTS_PER_CM));



return (PAGE_EXISTS);

}

}



}

you will see that i'm printing "text1","text2",etc in a certain position, now i want to replace those texts with caontents from an ArrayList. can somebody give me some hints,codes,links,examples,explanations,or anything that might help?
any help would be great thank you very much
18 years ago
now i understand that JSP doesn't actually "create" a native format MS-Office file...
OK i give up... maybe i should try the Jakarta POI project that you mentioned earlier, but can you give me a brief explanation of what it is, how to used it, how to combine it with JSP? or maybe a good reference would be great.... where should i strat learning about Jakarta POI?

thank you very much for your help....
18 years ago
JSP
i've already connected to the database..... it appeared to be my fault i copied the driver's jar file into Tomcat 4/common/lib instead of WEB-INF/lib/


thanks for all your help guys!
but anyway, i got another weird happens here...after i succesfully configured all those things on my PC then i want to do the same thing on my laptop. but it didn't work.....
is there any different configuration needed between windows XP pro and windows XP Home in this case? because my PC is operated by win XP Pro while my laptop is operated by win XP home
18 years ago
JSP
i've tried to check the spelling, and i double check it, but i found there's no mistakes about it.....i thank you very much for your help but if there's any further explanation for me to had i would very appreciate it...

thank you
18 years ago
JSP
i'm really sorry for being impatience but it is not my intention to do that....but it is because the deadline is hunting me down...
once again i'm really sorry, but usually this forum gives answer even quicker than i thought, so i assumed you guys were busy so i give some kinda reminder but once again i'm really sorry
18 years ago
JSP
please help.... i really need to know why it won't work....thank you very much
18 years ago
JSP
please help.....i would be very thankful.....
18 years ago
JSP
>Once the jsp page is rendered to the user, it is like any other web page. You >can save the page through the browser. Or is it that you want to do capture >the rendered page at the server side and then save it in the user's computer?

i am not sure which one is suitable for me, i just want to create a text file from a jsp page, just like creating an excel file from a jsp page using response.setContentType and response.setHeader, can it be done the same way? i've tried to change

response.setContentType("application/vnd.ms-excel");

response.setHeader("Content-disposition","attachment;filename=file1.sxc");


into

response.setContentType("application/vnd.ms-word");
response.setHeader("Content-disposition","attachment;filename=file1.txt");

but i have a text file contained with the HTML source code, what i want is that the text file contains the HTML page that seen on user's screen not the HTML source code

what should i do?
18 years ago
JSP
i have read the psoting concerning my issue but it seems nothing is exactly what i need. i need to create a text file based on the html page seen on the user's screen (the HTML page is generated by the JSP page, i mean it is originally a JSP page but it appears as a HTML page on the user's screen right?) and save it in the user's computer can it be done and how?

please help........

thanks
18 years ago
JSP
have a problem connecting JSP to SQL Server 2000 i have done these following steps :
i have download and install the j2sdk 1.4.2
then i have set the JAVA_HOME in the Environment Variables to the directory where j2sdk is installed
then i have download and install Tomcat 4.1 from apache.org
then i have set the CATALINA_HOME in the Environment Variables to the directory where Tomcat 4.1 is installed
then i have download the sqlserver JDBC driver from :
1.http://download.microsoft.com/download/4/4/8/448af92b-e571-4bb2-810f-46be921a718c/setup.exe
2.and from http://prdownloads.sourceforge.net/jtds/jtds-1.1-dist.zip?download

from file number 1 i have run the setup.exe and then copy the msbase.jar, msutil.jar, and mssqlserver.jar from the directory sql server JDBC driver installed to the Tomcat 4.1/common/lib.

From file number 2 i have extract the file and copy the jtds-1.1.jar file into the Tomcat 4.1/common/lib

the coding to connect is as follow (for each file, i have tried both files):
1.Class.forName(�com.microsoft.jdbc.sqlserver.SQLServerDriver�);
Connection conn = DriverManager.getConnection(�jdbc:microsoft:sqlserver://servername:1433;user=sa;Password=admin;DatabaseName=Northwind�);
2.Class.forName(�net.sourceforge.jtds.jdbc.Driver�).newInstance();
Connection conn = DriverManager.getConnection(�jdbc:jtds:sqlserver://servername:1433;user=sa;Password=admin;DatabaseName=Northwind�);

after i run the JSP file, i got a ClassNotFoundException for both driver ( com.microsoft.jdbc.sqlserver.SQLServerDriver and net.sourceforge.jtds.jdbc.Driver )
is there anything i haven't done???

for additional information i have tried to set CLASSPATH in the Environment Variables just to have the same result. I also tried to copy the tools.jar from the j2sdk/lib to the Tomcat/common/lib but it appears that the file is already exist.

Please help..........

thank you all
[ September 08, 2005: Message edited by: Bear Bibeault ]
18 years ago
JSP
i've tried iReport and jasperreport but it doesn't meet my expectation, i expect to have an application that can print a text file from a specific location, i'm thinking about designing the application with pure Java. So i need some references that can be used or related with my issue
but thanks anyway for your help i really appreciate it.....and for the upcoming helps i thank you all before
18 years ago
i need a complete reference about printing in java, especially which includes printing a bunch of data from a database in a particular format. so i wonder where can i find a good and reliable source (web sites,forums,or books) for it? it would be better if it comes up with some examples
thanks a lot guys..............
18 years ago