This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Update table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Update table" Watch "Update table" New topic
Author

Update table

john Dalton
Greenhorn

Joined: Jun 18, 2012
Posts: 12
hello,
I an new to jsp. i have a simple web app which performs some operations on a book database ( bookid, bookname, author,price as fields of a table).my problem is when i want to update a table,i put a checkbox on a side along with columns.
when i select any one of checkbox and clicks on a submit button it goes to update page.here i want to set the book id to check box and pass it to next page.

so my question is how can assign a variable in scriptlet to a name or id of a html check box.


Thank you
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61086
    
  66

Firstly, scriptlets? In 2012? Please read this JspFaq entry. No scriptlets should be used in any JSP code written after 2002.

Secondly, what you should do first is to figure out what the HTML to represent your display should be. All JSP does is to help you generate the HTML. So figure out what the HTML should be first, then figure out how to use JSP (with the JSTL and EL, not scriptlets) to generate that HTML.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
john Dalton
Greenhorn

Joined: Jun 18, 2012
Posts: 12
Here is my code.



In this i want to set the bid value to the property of the checkbox
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61086
    
  66

Step 1: refactor the JSP to remove the Java code. Database access should specifically never be done in the view.

You might find this article helpful.
 
 
subject: Update table