KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Good day! I am having a problem with the select box in html. I am on the EDIT portion of my simple CRUD project and before users can edit, the chosen data will be shown first and I retrieved it in the database through the servlet. Now I want the data I retrieve be the one SELECTED (default) in my select box. ${product.category} <select size="1" name="category"> <option value ="1">Dogs</option> <option value ="2">Cats</option> <option value ="5">Others</option> </select> I tried inserting it like this but it doesn't work. <select size="1" name="category" selected=${product.category}> <option value ="1">Dogs</option> <option value ="2">Cats</option> <option value ="5">Others</option> </select> I want to do something like this.. If (${product.category}==1), selected=option 1... I've seen something like THIS in one of the forums but it is in PHP format. How can I do it using JSP? Thank you very much.
Tags (comma-separated)
Save Edits
Cancel