This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes A query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "A query" Watch "A query" New topic

A query

Subhadip Pal

Joined: Feb 17, 2010
Posts: 4
In my application, I want to display all the rows from a table in a JSP.
The data that is to be shown should be populated in text boxes.

A user when successfully logs into the application will be able to view the Database table contents in the JSP Page, he can also modify the values from the Text boxes.
On clicking submit, the user should be able to post the whole of the Form will all the values altogether and the new values should be updated in the database.

Can you suggest a suitable approach for the same?

illustration :-

lets say we have an Employee table
table contents:-

EmpId Name Address Phone
231312 xyz213123 dasdas 0909090
324234 abc213123 asdas 0990898

now we need to display all the data (note the no. of rows are not constant) in the JSP inside the text boxes.
The user will be able to modify the data that is being displayed and on clicking submit the new data will be updated in the database.

I have build the application using Struts 1.2.7 and Hibernate 3.0.

Ankit Garg

Joined: Aug 03, 2008
Posts: 9466

Subhadip please Use A Meaningful Subject Line when you start a topic.

Have you done something till now or do you want us to give you a basic idea of how to achieve this?? This shouldn't be that hard to do, all the values can be easily submitted to an action which can update the values in the database. Read a basic tutorial on web applications, you'll grab basic knowledge of how to achieve this...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Subhadip Pal

Joined: Feb 17, 2010
Posts: 4
Hi Ankit,
I have already created the application.But got stuck at this point.
Actually when I fetching the data into a list from datbase using hibernate.

I am using

List<Employee> list = query.list();

As each element of the list contains a Employee object and due to these multiple objects i am facing problem .

I case there is only one row returned from the database I can assign these data from DTO into the
ActionForm class variables and then diaplay the form in the jsp using

<html:text property="name"> etc. etc..

but i cant do it as i dont know how many such employee objects .

Please suggest a soln. for the same...if possible..
Please suggest me a link to study the same
I agree. Here's the link:
subject: A query
It's not a secret anymore!