wood burning stoves 2.0*
The moose likes JSP and the fly likes JSP - Java applet connectivity Issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP - Java applet connectivity Issues" Watch "JSP - Java applet connectivity Issues" New topic

JSP - Java applet connectivity Issues

Bhavana Sasne

Joined: Jul 22, 2011
Posts: 2

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.

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

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

Joined: Mar 22, 2005
Posts: 41101
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.

Ping & DNS - my free Android networking tools app
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60780

To understand how JSP works, please read this article.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bhavana Sasne

Joined: Jul 22, 2011
Posts: 2
Thank you everyone for the information. After the Jar signing it works ..
I agree. Here's the link: http://aspose.com/file-tools
subject: JSP - Java applet connectivity Issues
Similar Threads
-security option on tomcat 5 when run as service
jdbc connectivity through applets
Writing a file and executing
java database connection