Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

method doesnt work when invoked from applet!

 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Let me tell you what I've done so far... I've got an applet class and a class that deals with database queries...(both combile without problem)



When i call the ItemDB.add() method from the applet, it doesnt work (nothing happens! & the item isnt added)...

can someone please suggest a solution?

thank you
Hannah
[ January 04, 2006: Message edited by: H Melua ]
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I guess when you say "the code here works fine", what you really mean is: "the code here doesn't work fine"

It's hard to say what code you don't show us might or might not be doing. But the combination of applets and databases suggest two possible problems, both related to the restricted privileges of applets:
- the DB host is not accessible to the applet (because applets can only connect to the host where they were served from)
- the driver classes are not part of the applet (or use native libraries), and so the driver can't instantiate them

You can information on how to work around these issues here.

If it's neither of these, you can post the relevant code with an indication of where it fails to execute properly.
 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it works because i tried it and it added a record to the database with no reported problems

i'll check your link and get back to you

here it is

thank you
Hannah
[ January 04, 2006: Message edited by: H Melua ]
 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok i've seen the policy file, but what do i change in particuler?
[ January 04, 2006: Message edited by: H Melua ]
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding something like the following should do the trick:
 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i dont know the value for this
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like "www.mycompany.com", or "localhost:8080", or whereever the applet is hosted.
[ January 04, 2006: Message edited by: Ulf Dittmer ]
 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont know the value for this


in english, where do i find it?
thanks
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you access the applet if you don't know what server it's hosted on? How do you upload it?
[ January 04, 2006: Message edited by: Ulf Dittmer ]
 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you see, i use BlueJ and by creating an applet class, i write click on the class object and choose "Run Applet", i get these options
(blueJ if u havnt tried it is an educational java tool supported by Sun, works differently to JBuilder and Jgrasp
http://images.apple.com/downloads/macosx/development_tools/images/bluej130_screen.jpg)

- Generate webpage only
- Run applet in appletviewer [thats what i choose]
- Run applet in web browser

!

in the appletviewer, there is an Applet menu>>>>Properties>>>>
- http Proxy server (with an empty field)
- http proxy port ('80')
- Class access (option- 'Restricted'/'Unrestricted')
(Command buttons 'Apply', 'Reset' & 'Cancel'

it was on restricted, but now i changed it, and i dont know if it will make any difference, because i'm still debugging my code, so i havnt checked!
[ January 04, 2006: Message edited by: H Melua ]
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, if you run the applet locally in your browser, make a note of the URL you see there. It should be something like "file:///path/to/directory/index.html". Then you can use "file:///path/to/directory/-" instead of "http://YOUR.SERVER.HERE/PATH.TO.YOUR.APPLET.HERE/-". Just remember to add the proper policy for the server later.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to applet forum now that we are discussing policies.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic