Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No connection to database from JApplet on Web page

 
maja neskovic
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I have created JApplet and placed it on the Web page. In applet, I have slider and submit button to confirm user's choice on slider. That choice (slider's value) should be written in the database. When I run the Applet Viewer in NetBeans everything works just fine (value is recorded in the database). For the Web page, I created a php file (and named it sub.php) which looks like this:
Hint: ime is the database's field name

I made this file to act as intermedier between the database and Web page (value from applet on Web page should be written in it and then read from the database). I wrote this code for connecting to that file in the applet:


It is written "localhost" here because I use XAMPP as local server and put jar, classes and html file in it's htdocs folder. Then I run the applet's html file localy in my browser.




Hint: potvrdi is my botton's name



If you have read all this, I'm very grateful for your patience and I hope you have any idea to help.
 
maja neskovic
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have succeed to make connection. I wrote:


When I start Web page, it inserts 2 values in the database - 1st is the initial slider value (it writes 500 because it is my initial slider value) and 2nd is the regular value which it gets when I choose value on slider and press submit button. Any idea how to change this method to prevent recording initial value when I start the Web page...?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A boolean variable?

Set it to false when the applet is starting (and you don't want to execute that code). Set it to true later (when you do want to execute that code). Test the variable before executing that code.
 
maja neskovic
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make that, how to set it false and later true? I wrote the method in the previous post. I think that problem is in the condition if (prHtml != null) fileToRead = new String(prHtml); but I don't know how to set it for my needs. Any idea...?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic