Hi there,
I really need some help understanding how to implement a part of a small web application I'm writing.
The actual web page is really just a form which they will use to calculate some property related stuff. But in order to speed things up for the user, the first time they use the form in a session, a lot of the form's fields will be filled in with values that come from their 'user settings' which are stored in a mySql database.
I have no problem with the
JDBC stuff, but what I want to do is take the user settings values and assign them to javascript variables that the webpage will then be able to use. I'm not sure how to go about doing this. I've made
servlets that use info from the client and send it to a POJO to do some work and then send back info to the client, but I here I want to serve up a new page with javascript global variables, whose values have been got from the database, already assigned.
Would I have to serve up the page, and then immediately send the variables via JSON or something? It would be great if I could just somehow assign the variables to the relevant javascript file and then send the HTML file, which would then get the javascript file that I've assigned all the new values to, if you get what I mean. I'm not at all sure if I'm on the right track though.
I'd be grateful for any ideas as to how I should be going about this.
Many thanks
Joe