aspose file tools*
The moose likes Struts and the fly likes how to display mysql table datas in jsp using struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to display mysql table datas in jsp using struts2" Watch "how to display mysql table datas in jsp using struts2" New topic
Author

how to display mysql table datas in jsp using struts2

Vasanth Rajasekaran
Greenhorn

Joined: Mar 01, 2012
Posts: 7
Hi i have made this code for getting the values present in my users table and display those values in a jsp using struts2.

My java code:




and my jsp code:



But when i run this code, i'm getting all the users values in 1x1 cell and all passwords values in 1x2 cell...
I want each users value and passwords value in a single row as a pair...
What must i do??? Pl help....
Thanks in advance!
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Struts2 having inbuilt mechanism to display the content if you want to customize it Use simple theme and customize it how to want it to display.

Struts2 Themes

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Vasanth Rajasekaran
Greenhorn

Joined: Mar 01, 2012
Posts: 7
Thanks Mohan Rao for your help...
Since I'm a beginner in Struts2 and also since i havn't worked in Struts1 I can't able to understand neither what you are telling nor the link you posted..
If you don't mind can I hav a sample code of tat Struts2 themes what you are mentioning???

Thank you!
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

My above answer is not relevant to your query. I think you are expecting this.



Vasanth Rajasekaran
Greenhorn

Joined: Mar 01, 2012
Posts: 7
But Mohan Rao, the code you gave is same as the code i used...
I'm getting the same output as I got before...
I need output of Users in one column and their corresponding passwords in next column...
Can you help me in how to achieve that???
Thanks!
vishwas gopala
Greenhorn

Joined: Mar 06, 2012
Posts: 3
Refer to the below link

http://www.vaannila.com/struts-2/struts-2-example/struts-2-control-tags-example1.html

HTH
Vasanth Rajasekaran
Greenhorn

Joined: Mar 01, 2012
Posts: 7
Thank you vishwas gopala...

Now it got worked...!
Ramkeeys Chandran
Greenhorn

Joined: Jun 11, 2012
Posts: 1
Hi,
you could do it by using the keyword "status" in the iterator tag..
in your example you could do like...
<table><s:iterator status="indice">
<tr><td>
<s:property value="username[#indice.index]"/></td>
<td>
<s:property value="password[#indice.index]"/></td>
<td>
</tr></s:iterator></table>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to display mysql table datas in jsp using struts2