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

Philip Pross

Ranch Hand
+ Follow
since Jan 17, 2001
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 Philip Pross

Hello to all,
I have a swing applet that requires the jre1.3.1, normally when all the broswers are close the java runtime should close and the icon in the taskbar should disappear as well. On my pc it does that, but for some others all is close, and the java is still running in the background ........ is this a bug with the plugin, or the computer.
Can anyone help me ???
17 years ago
I'm very new to xml, what I'm asking is if any one can suggest good books to do with java xml and servlets, on a unix platform.
I did find two books from Wrox (Professional Java XML , Java XML Programmer's Reference ), what I hope to complete with this project is to create, rewrite and read the xml files.
Phil
Thanks alot to everyone. I'm looking into all of the suggusted links.
Howdy, I was wondering if someone can help me out. I'm working with java 1.2.2 on a unix server, with all the tutorals around I'm feeling pretty confused. I found most examples use swing, how do I get around this. I want to keep the same java version ...........
Thanks
I'm learning javamail, and I came to this code I found.

import sun.net.smtp.SmtpClient;
import java.io.PrintStream;
public class SmtpClientExample {
public static void main (String args[])
throws Exception {
String host = args[0];
String from = args[1];
String to = args[2];
SmtpClient smtp = new SmtpClient(host);
smtp.from(from);
smtp.to(to);
PrintStream msg = smtp.startMessage();
msg.println("To: " + to);
msg.println("Subject: Hello SmtpClient");

msg.println();
msg.println("This is a test message.1");
msg.println("This is a test message.2");
msg.println("This is a test message.3");
msg.println("This is a test message.4");
msg.println("This is a test message.5");
msg.println("This is a test message.6");
smtp.closeServer();
}
}
I'm wondering if its possible to also send to a "CC", or do I send it twice
For now, I want to learn how to send maill without the javamail api, just to learn the basics.
Thanks
17 years ago
To call your second applet from the first, all you have to do is call another web page that contains your second applet.
in your eventHandle(ActionPerformed)
try
{
getAppletContext().showDocument
(new URL("http://yourwebpage.com/index.html";),"_self");
}
catch (Exception ex) {System.out.println(ex}
17 years ago
Very simple answer to a simple question, try using servlets to connect to your database. In your applet call the servlet by ...
try
{
url = new URL ("http://yourServer:8080/examples/servlet/yourServlet?para="+para2 +);
}
catch(MalformedURLException e)
{
System.out.println("error url " + e.getMessage());
}
catch (IOException e)
{
System.out.println("error io " + e.getMessage());
}
then in your servlet connect to the database by ...
String url = "jdbc dbc:vigie";
String nom="JAVA";
String pw="JAVA";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
c = DriverManager.getConnection(url, nom, pw);
}
catch (ClassNotFoundException e)
{
System.out.println(e.getMessage() );
}
catch (Exception ee)
{
System.out.println(ee.getMessage() );
}
I hope this help .... just check out JDBC tutorials on java.sun.com, it helped alot when I started
17 years ago
The problem isn't what version ..... yes thats what I'm trying to avoid (for the teachers to download the plugin)
Then again, I just came across another way ....
once the login I can open a new web page with the parameters for that user in the address.
ex : http://javaranch.com/mypage.html?userid=3 Then in my applet I can read the userid.
17 years ago
Hello to all, I have a programe for two types of users, one (teachers) where I want to use jdk1.1.8, and the other 1.3. My question is depending on the login it will determine what frame is displayed. My principal applet is compiled in 1.1.8 and so is my teachers interface, but for my other users (students) I want to use swing.
I've try this, but not advanced.
This is basically what I'm trying to do ...
Applet --> Frame -> another Frame (teachers)
-> or JFrame (students)
17 years ago
Hello to all, I'm in need of help towards JMF, I have a applet that that user can view a trailer, but I want to be able to show more then one film on the same applet(not at the same time). I have a class that needs the user to start the film, that works .....but if I'm in the middle, I want to start the second by pressing on the other button, nothing happens. Here a snippet .....

Is it possible for what I want to achive !!!
(edited to put formatting tags in)
Thanks
Phil
[ August 23, 2002: Message edited by: Cindy Glass ]
17 years ago
Thanks alot Syam, it worked great !!
This is what I did with your sample code

for(int i=0; i< iTemp.length ; i++)
{
if(iTemp[i] == 0)
{
sOutput += " ~";
continue;
}
preStatSuc.setInt(1,iTemp[i]);
rs1 = preStatSuc.executeQuery();

while( rs1.next() )
{
sOutput += rs1.getString("COSU_NOM") +" ~";
System.out.println("sOut " +sOutput);
}
rs1.close();
}
I even tryed like this
SELECT * FROM SUCCURSALE WHERE COSU_SUC=?,?,?,?,?,?,?,?,?,?,?,?,?,?,?";
and it then gives me this error ->
pos: 43 ' ... COSU_SUC=?^ ,?,?,?,?,?,?,... - syntax error
Howdy,
I need help with this snippet of code, in one table (QUANTITE) I need the quantities for a certain product, also I need to know the name of the client, but it is a number that is index in another table (SUCCURSALE ). Its crashs on the the line that has: preStatSuc.setInt(2, iTemp2);
Connection c = null;
PreparedStatement preStatQte = null;
String sqlQte = "SELECT * FROM QUANTITE WHERE COPQ_NOPR =?";
PreparedStatement preStatSuc = null;
String sqlSuc = "SELECT * FROM SUCCURSALE WHERE COSU_SUC=?";
try
{

preStatQte = c.prepareStatement(sqlQte);
preStatSuc = c.prepareStatement(sqlSuc);
preStatQte.setInt(1, Integer.parseInt(productnumber) );

rs = preStatQte.executeQuery();
while( rs.next() )
{
sOutput = "";
sOutput += rs.getInt("COPQ_DISP#1%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#2%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#3%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#4%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#5%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#6%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#7%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#8%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#9%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#10%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#11%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#12%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#13%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#14%") + "~" ;
sOutput += rs.getInt("COPQ_DISP#15%") + "~" ;
//TO GET THE NUMBER THAT IS THE KEY FOR ANOTHER TABLE
int iTemp1 = rs.getInt("COPQ_SUC#1%");
int iTemp2 = rs.getInt("COPQ_SUC#2%");
int iTemp3 = rs.getInt("COPQ_SUC#3%");
int iTemp4 = rs.getInt("COPQ_SUC#4%");
int iTemp5 = rs.getInt("COPQ_SUC#5%");
int iTemp6 = rs.getInt("COPQ_SUC#6%");
int iTemp7 = rs.getInt("COPQ_SUC#7%");
int iTemp8 = rs.getInt("COPQ_SUC#8%");
int iTemp9 = rs.getInt("COPQ_SUC#9%");
int iTemp10 = rs.getInt("COPQ_SUC#10%");
int iTemp11 = rs.getInt("COPQ_SUC#11%");
int iTemp12 = rs.getInt("COPQ_SUC#12%");
int iTemp13 = rs.getInt("COPQ_SUC#13%");
int iTemp14 = rs.getInt("COPQ_SUC#14%");
int iTemp15 = rs.getInt("COPQ_SUC#15%");

preStatSuc.setInt(1, iTemp1);
preStatSuc.setInt(2, iTemp2); //CRASHS HERE
preStatSuc.setInt(3, iTemp3);
preStatSuc.setInt(4, iTemp4);
preStatSuc.setInt(5, iTemp5);
preStatSuc.setInt(6, iTemp6);
preStatSuc.setInt(7, iTemp7);
preStatSuc.setInt(8, iTemp8);
preStatSuc.setInt(9, iTemp9);
preStatSuc.setInt(10, iTemp10);
preStatSuc.setInt(11, iTemp11);
preStatSuc.setInt(12, iTemp12);
preStatSuc.setInt(13, iTemp13);
preStatSuc.setInt(14, iTemp14);
preStatSuc.setInt(15, iTemp15);
rs1 = preStatSuc.executeQuery();
while( rs1.next() )
{
sOutput += rs1.getString("COSU_NOM") +"~";
}
rs1.close();
out.println(sOutput);
break;
}
}
this is the error I get
->
java.lang.ArrayIndexOutOfBoundsException
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setInt(Unknown Source)
at ViDetail.doGet(ViDetail.java:197)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:597)
at org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Unknown Source)
help please .... Phil
Hello Ranchers,
I have a question towards sql, I have a search engine with 4 params. Meaning the using can do a search on 1 thing, 2 or even all 4 things, the search contains a first name, last name, city, and country. And with this, there is a number id for each person, so in theory is a user looks for a person with the last name WOOD (returns id 2, 4, 9), and location is CANADA ( returns 1, 2, 11), there should be only one result id number 2.
thanks Phil
Byron,
I think I can answer all the question simple by saying what I'm using. Its Tomcat 3, so if I want access to my servlets I must execute my servletrunner. And when I know the connection is lost is when I want to login, I send the params to the driver, but when I get the response, its null. Also, if my servletrunner is not connected at all, I get a connection error. I hope this may help you.
Phil
18 years ago