Todd Bush

Greenhorn
+ Follow
since Mar 06, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Todd Bush

I guess it took me a while to figure out the pupose of interfaces. An interface is just a basic agreement of the methods and signatures any class must contain by implementing an interface. Here's an example....
public interface Animal {
public String makesNoise();
}
public class Dog implements Animal {
public String makesNoise() { return "bark"; }
}
public class Cow implements Animal {
pulbic String makesNoise() { return "moo"; }
}
public class DogCow implements Animal {
public String makesNoise() { return "mork"; }
}
so is any class uses an Animal they could just say....

Animal myAnimal = getAnimal() // return the current animal
String myNoise = myAnimal.makesNoise();
System.out.println(myNoise);

23 years ago
In the first sample, the whole method is synchronized. In the second, only the code between
synchronized(this) {
//code
}
would be synchronized.
It could be that the servlet is failing. Check stderr.log and stdout.log
24 years ago
#1 is correct. To keep any variables or object references from saving with a serialized object, declare them as trasient.
24 years ago
Maybe I'm missing something here. If your class is in
Package org.temiqui.mypackage;
and your are running from
C:\Java\org\temiqui\calendartable>
wouldn't C:\Java\org\temiqui\calendartable have to be in your classpath as well. Or of you ran the app from C:\Java there shouldn't be any package confusion.
24 years ago
Passing data between applets and servlet is quite easy. I've implemented a solution passing data as serialized objects using ObjectOutputStream and ObjectInputStream.
In the applet...
URL url = new URL("servlet/myServlet");
Integer data = new Integer(1);
Serializable objs = data;
URLConnection con = url.openConnection();
con.setDoInput(true);
con.setDoOutput(true);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
out.writeObject(objs);
out.flush();
out.close();

In the servlet....
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ObjectInputStream in = new ObjectInputStream(req.getInputStream());
Integer myData = (Integer)in.readObject();
}
And of course you can send data the other way.
Hope this helps.
24 years ago
This is what I would try with JRun. Find the compiled corresponding .class file for that jsp and delete it. This should force Weblogic to recompile your .jsp.
24 years ago
I once had many problems getting an Applet to communicate remotely with RMI. One reason, IE does not include the java.rmi.* libraries, so any applet running in IE does not have them available. You are able to download them from Microsoft, but every client who uses your applet must have them. A solution I've used is to have your Applet communicate directly with a servlet and the servlet preforms the RMI calls.
Good Luck.
24 years ago
Ok Ray, just simmer down.
Bring it down a notch.
Can't one just odbc to it?
Actually I believe you copy of WinZip has expired.
24 years ago
I've done something similar. I pass data from an Applet to a servlet, the servlet searches the database, the results are sent back and displayed in another browser instance. Basically, the applet opens the new browser using the URL of the servlet...

postData = //URL encrypted post data
URL searchURL = new URL (servletBase,"servlet/SearchServlet?"+postData);
URLConnection conn = searchURL.openConnection();

conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type","text/html");
//Open another browser window and show the servlet results
appletContext.showDocument(conn.getURL(),"_blank");
I know this isn't exactly what you were looking for, but it might help.
Good luck.
24 years ago
Hopefully this will help you. This is how I am doing it....
This is called to add a sourceName and sourceType to the db. A boolean is returned weither the action was successful or not. The code Integer indicates to the Servlet which function to use. My servlet houses many functions. I place a call to postObject to do the actual transfer (code at the bottom)
public Boolean addSource(String SourceName, String SourceType) throws Exception {
servlet = new URL(webBase,"servlet/AZUniversalServlet");
Integer code = new Integer(5);
Serializable objs[] = { code, SourceName, SourceType };
in = postObjects(servlet, objs);
Boolean result = (Boolean)in.readObject();
return result;
}

private ObjectInputStream postObjects(URL myServlet, Serializable myObjs[])throws Exception {
URLConnection con = servlet.openConnection();
con.setDoInput(true);
con.setDoOutput(true);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
int numObjects = myObjs.length;
for(int x= 0; x<numObjects; x++)
out.writeObject(myObjs[x]);


out.flush();
out.close();

return new ObjectInputStream(con.getInputStream());
}

Good Luck.
Todd
24 years ago