Philip Thamaravelil wrote:Ajax is a "buzz word" for Javascript
You can definitely communicate to your backed to save your changes using jQuery.
Alexey Timokhin wrote:Thank you for the article, it was quite a nice read, but it did not shine any more light on my problem.
Bear Bibeault wrote:
... but saying "use Ajax" doesn't mean to just use JavaScript. Ajax is just a small part of JavaScript.
Alexey Timokhin wrote:Am I allowed to access my bean from inside <script>, or will that make veterans frown upon my style?
Philip Thamaravelil wrote:I'm curious, explain how one would make an AJAX call without the use of Javascript.
Philip Thamaravelil wrote:
Alexey Timokhin wrote:Am I allowed to access my bean from inside <script>, or will that make veterans frown upon my style?
Javascript is used to manipulate the DOM elements. So you'll need to store your needed bean values in the DOM in order to access them via JS.
Cheers,
Philip
Alexey Timokhin wrote:I think you are right, I did have a slightly skewed view of a JSP. I understood the server side/client side difference, but what is the underlying code for a submit button/function? If it sends the information to the server, would that make it a default JS function that sends the HTTP request? (I never gave such details much thought :P )
Am I allowed to access my bean from inside <script>, or will that make veterans frown upon my style?
Philip Thamaravelil wrote:So you'll need to store your needed bean values in the DOM in order to access them via JS.
Alexey Timokhin wrote:
I'm not really sure what you mean by that. What I had in mind was something like <script> if($(this)) <jsp:setProperty....> </script>, where in the bean I would have an array of some sort that would store the needed values.
Bear Bibeault wrote:
Alexey Timokhin wrote:
I'm not really sure what you mean by that. What I had in mind was something like <script> if($(this)) <jsp:setProperty....> </script>, where in the bean I would have an array of some sort that would store the needed values.
Read the article again. You haven't yet grokked the fact that once the page is sent to the browser where the JavaScript is evaluated. The JSP and any beans are long dead and gone.
Bear Bibeault wrote: They could be if that makes sense, but if the bean values don't need to be associated with particular elements, I'd just create a JavaScript construct that captures the required values.
Alexey Timokhin wrote:
Would that mean I need to create some memory spaces inside JS and store the values there, and on Submit or page reload, store the values inside the bean, do the needed processing, and display what needs to be displayed?
Philip Thamaravelil wrote:Again... you COULD create a construct if that makes sense,but is not necessarily the best way
Philip Thamaravelil wrote:
... and access your bean values store as javascript variables to save your data.
Alexey Timokhin wrote:It has a bigger "educational" emphasis than other communities.
Alexey Timokhin wrote:
I'm kind of stumped. May you provide an example?
Alexey Timokhin wrote:Side-note: to be honest, I expected less from this forum, so thanks a lot guys. It has a bigger "educational" emphasis than other communities.
Alexey Timokhin wrote:
Apparently, this is how you store the info to the server to the page.
Alexey Timokhin wrote:This kind of reminds me of the "session" attribute.
I assume the key names would all have to be different, and when I want to retrieve the values, I would have to call all those keys from the server?
I was sort of imagining I would be able to store everything somewhere, but not on the server.
Bear Bibeault wrote:
Never POST to a JSP. JSP's are for constructing views. Any other usage is a violation of best practices. POST to a servlet always.
Alexey Timokhin wrote:
Bear Bibeault wrote:
Never POST to a JSP. JSP's are for constructing views. Any other usage is a violation of best practices. POST to a servlet always.
I don't really understand what you mean.
In my JSP, I use several servelts that help me process the pages in table creations and some value retrieving. So how and where would I post it?
What ideally I wanted was to get value the name of each textbox that was clicked and the value that is currently inside of it and store it in an array for processing. After I click some arbitrary button I created, it would refresh the page and process that array inside the bean, which would update the database, so the values displayed in the table would be those updated values.
Bear Bibeault wrote:
User selects specific text boxes for processing. (How, as well as how to visually indicate this TBD)
Paul Clapham wrote:It's worth remembering that if the user does not put anything into a text box in a form, then the parameter corresponding to that text box is not sent when the form is submitted.
Alexey Timokhin wrote:I am populating those text boxes from the database, and if the DB cell is empty or null, I treat it as 0 (all text boxes are for numeric storage).
The only problem I have is I'm not really sure how to submit only specified text boxes. Doesn't "submit" submit all components inside the form? Or can I submit values in a form only judging by their "class", or "id" or some other identifier?
And is there a way to check EVERYTHING that was submitted? Because the key is the text box "name" value, and the request call receives the value through the component's "name"
Alexey Timokhin wrote:Here is an example to define what I meant by "specified": You have 10 text boxes on your page. All of them have information in it. Instead of submitting all of them, I want to submit 1,5,7 and 10th text box, and omit the others.
When form is submitted, I would need some of the component's attributes, not only its parameters. Is it possible?
Don't get me started about those stupid light bulbs. |