Hello All hope this is an appropriate place to post this. My user interface contains an applet which need to communicate with a database in response to the user clicking buttons and stuff. It can't do this without being signed because the database is on a different machine than the server the applet came from. I don't want to sign it (looks to scary to the user) I get around this by letting the applet call a servlet back on the machine it came from and say "go do some database stuff for me and send me the data" This works fine as long as the data is a bunch of strings but that will get unmanagable. I can't pass a resultset back because it's not serializable. What I want to do is have my own little "data class" which the servlet will unpack the stuff out of the resultset into and send that back to the applet. My problem is how to make both the servlet and the applet "aware" of this class. I currently have my applet in the directory above WEB-INF where you would find jsp's and html and stuff, my data class is in WEB-INF/classes. This work's in my development environment but not in the real world. I think my IDE (Netbeans) is managing my classpath differently than Tomcat. What's the proper way to handle this situation. I realize this is really a classpath issue but I hoped someone here would know the answer, it's the same as wanting a servlet and a jsp page both to be aware of some custom class
Joined: Jul 12, 2004
Ok. I think you are right about the classpath problem. For the servlet, it should work all right, no problem with it. Where I see a problem is with your applet definitively. The applet is running in a separate JVM so with it`s own classpath. So, I don`t think that your example of servlet communicating with JSP is the same thing.
Your applet is in a Jar file, right ? Have you tried to add the class in the jar files with proper import statements ? Because, even if you set your classpath correctly (for your applet), you won`t be able to do it for all the client`s classpath
Hope this help ! Please, give me more info if I didn`t understand correctly your problem !
F.<br />SCJP, SCJD, SCWCD, SCBCD<br /> <br />Failure is not an option... It comes with the software bundle.
Joined: Sep 16, 2003
hmm, you're thought about my situation being different from a jsp/servlet combination is correct. At the moment my applet isn't in a jar file but I plan to put it in one before I'm done. My applet is in a package with some other little custom classes which it needs, if I put my "data class" in that package it solves the problem for the applet but breaks the servlet. I don't want to have to maintain two instances of the "data" class. My applet contains a JTable which is displaying stuff from the database, the table uses a custom tablemodel and some other custom classes which are all in the same package with it. Let me try to make a model of my layout
dang, I thought there was some way to preview this lord knows what it'll look like Hopefully you can see that I want the applet and the servlet to both be aware of the "data" class so they can use it to pass stuff back and forth to each other
this is probably the part where somebody says "you're doing it all wrong, there's a much easier way"
Any Ideas??? Dave
Joined: Jul 12, 2004
Hi again Dave, Easy part ? mmmm.... :roll:
I understand your concern about 2 classes. The only way I can think of is when you will jar (could it be a verb ? ) your files for your applet, you can place the applet`s jar file in such way it would be in the classpath so the servlet might use the file. Only one file in this case.
Just an idea...
[ March 02, 2005: Message edited by: Frederic Filiatrault ]