File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Html Select - to make an option selected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Html Select - to make an option selected" Watch "Html Select - to make an option selected" New topic
Author

Html Select - to make an option selected

Thilothama Green
Greenhorn

Joined: May 13, 2004
Posts: 14
Hi all,

I am working in struts and I have a scenario. I have 2 web pages. First page has a table which displays values from a database table like
code, description.
Description columns values are all hyperlinks and when clicked goes to the second page where code, description and other select box is there. All these values correspond from the first page. I want to populate that select box with the value for it from the database.

eg . 1st page code, description
1 Desc 1
2 Desc 2

on clicking desc 1 goes to 2nd page with text box for code and desc and a select box to assign category for that particular record.

How do i make the select box on load get selected with the value of the desc's category....

i can load the select box from the database but couldnt make it selected with a particular value..

give me ur suggestions

thilothama
Kedar Dravid
Ranch Hand

Joined: May 28, 2004
Posts: 333
In your Action class for retrieving the record to be displayed on clicking on a particular link, retrieve the data specific to the link, and copy it (the DTO) using BeanUtils.copyProperties() method to a form object which u will use on the page which displays the editable record.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Html Select - to make an option selected
 
Similar Threads
The selected checkbox should be checked
Select box get refresh after populating the data into a table.
List Box problem
Dynamic Combo Box in JSP using AJAX
Using Combo Boxes in JSP & Servlet