Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Which server-side script takes the input from JavaScript in j2ee application

 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which server-side script takes the input from JavaScript, can access the database if it needs to, and processes the data.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?? )
 
Sheriff
Posts: 9692
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is how the usual AJAX script goes:

* 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


From this lines i asked you
 
Ankit Garg
Sheriff
Posts: 9692
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...
 
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rajendra Prakash wrote:Here is how the usual AJAX script goes: ... sends a request to a server-side script using XML ... Using XML again


XML is not used when sending the request to the sever, and XML is only one of many text formats that can be used for the response.
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
of course you can access database using jsp(scriptlet )
 
Ankit Garg
Sheriff
Posts: 9692
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

luke yu wrote:of course you can access database using jsp(scriptlet )


Only if you want to dabble in extremely poor practices and write code like it's still 1998.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tonight I'm gonna code like it's nineteen..... nine...ty nine.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Bear Bibeault
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No one is talking about maintaining old pages, but coding new ones (or refactoring to bring pages that need lots of changes into the modern era).

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic