I'm struggling with this for days now.
For a schoolproject I need to build a basketmanager in java. It stores data from players like how many three pointer they have made in this season.
I have a desktopversion wich is working perfectly fine and an applet version wich also works perfectly fine in an applet viewer, but I also have a web project
in wich I call a jsp page from a servlet. On that jsp page the applet is loaded correctly but I can't see any data... And I don't know why or what to do to make it work.
To make matters even worse, my data is stored in a MS Access database. Can somebody please tell me how I can make the applet on the jsp page work just like in the applet viewer.
Here's my jsp code:
thanks for your help, I can't find the solution on my own after hours of googling and trial and error.
Your applet most likely will need to be signed in order to be allowed to access an Access DB. Start reading here about how to make that happen: https://www.coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem
but when I launch it in my web application, the javacontrol panel now tells me that I have an SQL exception and that it can't find the database.
So I still have one question, where should I put the accdb file so the jar can access it?
private static String databank = "./basket.accdb"; this is used to built connection with databank, the code is fine but what's my ./ directory to put basket.accdb in in a web environment.
This is my directory structure where the jar resides:
inside the folder Web Pages we have the jar and the accdb database but when I run it, the jar can't find the database.
Ulf Dittmer wrote:You need to use absolute paths, not relative paths.
Absolute paths on a webserver, I guess I can understand why, but what if you move the web files from one server to the other... ?
I always thought relative paths where best practices.
What's the startup folder for a webproject? Just Web? I'll give it a shot, this means I'll have te make a new jar file and sign it again.
Ulf Dittmer wrote:There's no concept of a relative path for web apps, so you must use an absolute path. ServletContext.getRealPath(java.lang.String) can help you abstract out the path to the web app root, thus addressing your concern.
Thank you for the clear answer, I'm glad I finally found a good place for java help and learning. I already learned a lot.
This solved all my problems + signing the jar.