Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP - Java applet connectivity Issues

 
Bhavana Sasne
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am stuck with few problems related to JSP - Java applet file write and database connectivity issues.
1) Calling the applet class from JSP works in the web browser. But the file write code written in applet does not work when called from JSP ( It works if the program is separately executed as a Java applet).

2) Also java database connectivity works when executed from Java applet separately, but does not work when called from JSP.

Tried the following things to make this work, but no success:-
--> According to Tomcat Security Manager
" The security policies implemented by the Java SecurityManager are configured in the $CATALINA_HOME/conf/catalina.policy file. This file completely replaces the java.policy file present in your JDK system directories "
So granted permission to the folder where file is to be written using java.io.FilePermission in catalina.policy file of tomcat, but still does not work for JSP

Please help if anyone has come across this issue.

Thanks
Bhavys
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of that is rather confusing, but my general impression is that you don't understand that a JSP runs on the server and an applet runs on the client. Therefore if a JSP tries to write to a file (which is a bad practice), it writes to a file on the server, and if an applet tries to write to a file, it writes to a file on the client.

As for database connectivity, apply the same principle. JSP runs on the server, applet runs on the client.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applest are restricted in what they are allowed to do; file I/O is an area applets can't do, unless they are signed. See http://www.coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem for details.

Tomcat and its security manager have nothing to do with the applet's permissions.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To understand how JSP works, please read this article.
 
Bhavana Sasne
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you everyone for the information. After the Jar signing it works ..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic