Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JS and JSTL

 
san krish
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement like this.
I have page 1, which has all address details with current and permanent address.
In page 3, I have fields similar to page 1 that contains current and permanent address. I should in addition have a checkbox which says same as current address.
This when checked should pull all current address details from page 1 and display in page 3 dynamically without reload of page. This has to be handled in JavaScipt. How do i handle this?
Because on 1st page load, the input field should be empty though JS should contain field values and render them when checked.
I use JSTL in JSP. Please help me to proceed.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make a request to the server without a page refresh requires Ajax. This has nothing at all to do with the JSTL.
 
san krish
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you reply.
Is it possible that instead of requesting from server, I egt those request values on page load and use them in JS? not using Ajax
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can preload all the data you'll need in JavaScript data constructs (please use JavaScript rather than JS) you won;t need to go back and get them from the server.

This is not always possible as the data that will be needed may not be known up-front.
 
san krish
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
I will get the data from java object when the page is loaded.
So in this way how will i have these values stored in java script and render to UI when checkbox is clicked?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like it could work for you.
 
san krish
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again.
I assume it would work. But not sure how the scripting has to be handled. Do you have any sample code that would help me proceed.(that stored value in javascript) and renders them to input variables on click of checkbox?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's too vague to offer anything. I use jQuery to make such things easy.

I suggest you try your hand at what you need to do, and if you run into troubles, start a topic in the HTML/JavaScript forum for help.
 
san krish
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. thanks for your valuable time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!