Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display mysql table datas in jsp using struts2

 
Vasanth Rajasekaran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vasanth Rajasekaran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My above answer is not relevant to your query. I think you are expecting this.



 
Vasanth Rajasekaran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
 
Vasanth Rajasekaran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you vishwas gopala...

Now it got worked...!
 
Ramkeeys Chandran
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic