Prev: Issue with request.getParameter function in Java Servlet
Next: need suggestion for HTML Renderer for java
From: Daku on 23 Mar 2010 01:59 Could some Java guru please help ? I have a JSP, which calls a Servlet, which in turn does some database queries, and then generates a Web page, in its 'doGet' method, and displays the retreived data. The retreived data is displayed as a set of checkboxes with suitable labels and all. By seelcting appropriate checkboxes, and clicking on a button, the user adds the selected item to another list. I was wondering if there is a way to achieve the same something like the following - the user simply passes the mouse over the items he/she wants (no checking of checkboxes) and the items get selected. Any hints, suggestions would be of immense value. Thanks in advance fro your help.
From: Fingolfin on 23 Mar 2010 05:35
On 23.3.2010. 6:59, Daku wrote: > Could some Java guru please help ? I have a JSP, which calls a > Servlet, which in turn does some database queries, and then generates > a > Web page, in its 'doGet' method, and displays the retreived data. The > retreived data is displayed as a set of checkboxes with suitable > labels and all. By seelcting appropriate checkboxes, and clicking on a > button, the user > adds the selected item to another list. I was > wondering if there is a way to achieve the same something like the > following - the user simply passes the mouse over the items he/she > wants (no checking of checkboxes) and the items get selected. Any > hints, suggestions would be of immense value. Thanks in advance fro > your help. There are several methods checking checkboxes with JavaScript, here is one: <p>Please select a sport that you like to play.</p> Soccer: <input type="checkbox" name="sports" value="soccer" onMouseover="if (!this.checked) { this.checked = true; } else { this.checked = false; }" /><br /> Football: <input type="checkbox" name="sports" value="football" onMouseover="if (!this.checked) { this.checked = true; } else { this.checked = false; }" /><br /> You could put checking/unchecking in a separate function also, for that instead of "this.checked = true;" you should place a function call that passes a checkbox number and the function would be something like: "form.sports[checkBox].checked=true". But nevermind that, if you want to write the changes in the database as you hover your mouse over these checkboxes (without clicking a button) I believe you should use Ajax. |