2

I'm a building a web application in java. I have to create an applet for displaying some charts to the clients. The problem is that I don't want the applet to connect directly to the database for security reasons.

Which is the best way to get the data without connection to the database? I was thinking of creating a servlet which sends the ResultSet or a list of Strings to the applet with URLConnection. But I'm not sure this is the correct way!

2 Answers 2

3

Yes, providing a servlet that returns the results in JSON or XML format is the most sensible approach.

Sign up to request clarification or add additional context in comments.

Comments

1

There are many ways to do that. If Java Applet is the solution for you I think you should make a Apache Commons HTTPClient and request a Servlet running on your server. The servlet make the communication with the DB and return the data in either XML or JSON which is you can parse on the Applet.

There are other ways to do that as well. You can make Web-Services for that which serves the same purpose. If I would be on your place I will put my money on RESTFul Service. :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.