In form I use PageableListView to iterate TextFields. But when I submit form it only validate current page of PageableListView. Also when I back to eg. Page 1 all values I filled disappear.
When I change PageableListView to standard ListView all works fine – validation and submitting.
I set in ListView: setReuseItems(true).
How validate all items in PageableListView?
You can only validate items that are in the form, on the screen. If you wish to validate stuff on the first page, I think you need a (ajax)FormSubmittingBehavior on the paging controls, so your form is submitted each time you navigate to another page.
If you submit the data, it will also be stored if there are no validation errors.
Related
I want to create a jsp page that dynamically remove and add form input like in the picture.
when i click add the form will add new form but if click minus sign the form will be removed.
I don't know how to do it, since i am poor on javascript and jquery. can you help me ?
I have a HashMap< String, List< Integer>>. Is it possible for me to display a dropdown box in velocity based on the String keys in the HashMap and when the user makes its selection to display the List< Integer> below the dropdown?
Velocity is server side, HTML lives in a browser on the client side. When the user interacts with page, Velocity has long since ceased to be executed. So no, you can not use values from the live DOM in Velocity. You can, however, send back the selected value to Velocity:
Render the initial HTML page with a <select> that lists the top level options, in a <form>
The user selects something from the <select> and submits the form
Back on the server, Velocity can then read the selected value from the request and generate a new HTML with the second level options
If you don't want two page loads, you can either use an AJAX request to get just the list of valid values, or you can send the whole map in the first step (hidden in the HTML) and process it clientside with JavaScript.
I have a java servlet application where the database is populated by selecting an entry from a dropdown list and entering the values. On another page I have the same dropdown list and also have a find button to display the values that were previously entered by selecting an entry from the dropdown list. I want to get rid of this find button and dynamically display the previously entered values on this page. I heard this can be done using ajax. Please help me out.
Since the code is too much to share I have uploaded the snapshots of both the pages.
https://www.dropbox.com/s/10qmpxzwm8sik8a/1.PNG?dl=0
Here I am entering the values in estimate by selecting the project
https://www.dropbox.com/s/w8macftnm3rez3a/2.PNG?dl=0
Here I want to get the values just by selecting the project from the drop-down without clicking the Find button
You need to be specific with your question.
If I got you right...
You can use a variable in javasceipt to hold the value that was enterd on the other page you got.
Then while using the dropdown on the other page you can retrieve the values that you store and use a simple ajax request with json data to your servelet.
Check here for examples: http://api.jquery.com/jquery.ajax/
i need to show an HTML page to users
but every group of users will see parts of this page differently.
for now i have a JSP page in its basic form
and i need that when a user clicks on a button
everyone in his "group" will be notified. say by painting the button blue.
what i thought is that every browser will ask the servlet if a button was clicked
and once a user clicks a button the answer will be "true"
the problem is that EVERYONE gets notified. also users not in his group. all the buttons are painted.
i think it is because i add a class "blue" to the button and then when the other users ask, the JSP is changed (with the class blue to the button)
you need to identify users that are requests your jsp.
Basically there are two ways to achieve this :
using HttpSession, #see tutorial session
using URL parameter, #see tutorial url parameters
As for me ill use session for this :
//ex. for every user in group add a identifier in session.
group 1 => request.getSession().addAttribute("groupId","green");
group 2 => request.getSession().addAttribute("groupId","blue");
//then in jsp
<input type="button" class='<%=request.getSession().getAttribute("groupId")%>'></input>
In my project(working on Spring and hibernate) i need to keep around 22 HTML dropdown for a form, each dropdown have around 30,000+ entries every dropdown fetching data from database because of this page loading getting delayed (40+ sec) now i wanted to replace dropdown to similar function one, now i thought to keep autocomplete text box, now i wanted to know major performance issues in HTML Dropdown and autocomplete textbox or any suggestion or any alternative for this Thanks in advance.
I think use of autocomplete text box is more beneficial than dropdown.
In case of dropdown, data is loaded at once so it get delayed.
In this case only one request is made to database.
In case of autocomplete text box,data will load in exactly required text box.
So loading time for jsp reduces sharply.
(a) For autocomplete text box,there is no need of using any kind of plugin, as one can manage it easily.
(b) Use simple json format for providing input to text box using ajax.
(c) Define condition on text box for firing ajax request for showing text like..
want to get text after typing 3 characters etc...
You can also use jquery chosen plugin.
You can have normal select box with the jquery chosen plugin applied to that particular select box.
Refer http://davidwalsh.name/jquery-chosen