It's not a secret anymore!
The moose likes JSP and the fly likes Populate Form Elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "Populate Form Elements" Watch "Populate Form Elements" New topic

Populate Form Elements

Jason Stortz
Ranch Hand

Joined: Jan 11, 2001
Posts: 68
Does anyone know how to make the form elements in a JSP populate automatically? I am getting very sick of doing:
input type="text" name="text" value="<%= myvalue %>"
This is even uglier with select lists, those of you who have done this know what I mean.
Anyone got any ideas?
I have all the values when entering the JSP I just want to be able to do something easy to make the form populate with those values.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17026

Struts is good for this. Take a look at and read the docs on Form Beans.
If you need a quick overview of Struts and can get your hands on the April 2002 issue of Java Pro magazine, I humbly offer my attempt along those lines. Unfortunately the online issue has now gone over to May and the April hasn't yet been added to the archives, so you'll probably have to chase down a print copy.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Populate Form Elements
jQuery in Action, 3rd edition