I have a form made in jsp page, which allows user to store some values of a product like name, category & many more.
Below is my form in a brief way:
<div class="element">
<label for="element">Product name </label>
<input id="name" name="name" class="text err" />
</div>
<div class="element">
<label for="category">Category </label>
<select id='stateCombo' onchange='stateComboChange();'>
<option value='-1' title='-select one-'>-select one-</option>
<option value='0' title='Mobile'>Mobile</option>
<option value='1' title='Nsw'>Routers</option>
<option value='2' title='Tas'>Datacard</option>
<option value='' title='Tas'><%=request.getAttribute("category") %></option>
</select>
</div>
Now my main focus is on category element. I want to show category values from db as option within select tag. I have used list in request.setAttribute("category",list) where list contains category name values from db.
But my output shows like:
[universe.shopping.dto.Category@33008c73]
[universe.shopping.dto.Category@33008c73, universe.shopping.dto.Category@6904ec2d]
"universe.shopping.dto.----" this is my bean class package
I have created bean class and using list i'am getting values from db.
In short i need to know best possible way to store values from database within option in a drop down manner within select tag.