Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Html Select - to make an option selected

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I once met a man from Nantucket. He had a tiny ad
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!