Rajendra Prakash wrote:Which server-side script takes the input from JavaScript, can access the database if it needs to, and processes the data.
Rajendra, your question (?) doesn't make sense, please clarify!
What are you trying to achieve, what are you having problems with? (Don't know how to pass parameters from JS to the server-side app? Don't know which scripting language can access those parameters? Don't know how to process them in a servlet in Java?? )
Javascript variables cannot be accessed in servlets. javascript is executed on the client side. You'll have to make a request to the server (maybe an Ajax call) to send the values of the javascript variables which you want to process on the server side...
* Some action triggers the event, like the user clicking a button.
* The AJAX call fires, and sends a request to a server-side script, using XML
* The server-side script (PHP, ASP, or whatever) takes the input from JavaScript, can access the database if it needs to, processes the data.
* Using XML again, the script sends the data back to the original client-side page that made the request
* A second JavaScript function, called a callback function,catches the data, and updates the web page
The AJAX call fires, and sends a request to a server-side script, using XML
This is the key step. You'll have to send any request parameters to the server in the Ajax request. It can be sent as query string if the ajax request is a GET request or as request body if you are using POST Ajax request. Search on the internet for some tutorial on how to send parameters in an Ajax request...
Rajendra Prakash wrote:Is it possible to use jsp(server side scirpt ) to take the input from JavaScript, can access the database if it needs to, processes the data.
Your question is still not clear. I hope this is not what you are expecting (as it is not possible)
"A page is opened in the user's browser. You set the value of a javascript variable to 10. The page is posted back to the server. You try to access the value 10 from the javascript variable"
As I said earlier, to send a request to the server using javascript, you'll either have to make an ajax request, or open a new pop-up window from javascript using window.open...
Bear Bibeault wrote:
Only if you want to dabble in extremely poor practices and write code like it's still 1998.
David wrote:
Tonight I'm gonna code like it's nineteen..... nine...ty nine.
I completly Agree . but what to do ? . but somebody[most of the programmer(since maintenance project is more)] still need to code (change) java code in jsp. Even many small company use to code java in jsp in development project still(2009) .
if client pay for you to write this in 2009, you should... right?
And the business value for moving the code out of the JSPs is there anyway, as it makes things more testable (if done correctly), easier to document, and so on.