Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me out to list a table of conent in jsp using struts2

 
biny panackal
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am a bit confused that whether i can able to build user friendly applications using struts 2. Now i need to display a list of details say.
employee_cod | name | address | phone number
_________________________________________
01 biny xxx 444
02 xx xxx xxx


how can i do that. is there any tag for displaying things as tables an i also must be able to edit the records on a the click of the row..


If any body know any solution please help me.


All attempts are highly appritiable...

Regards,
Biny Balan
binypanackal@gmail.com






 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can do this by using logic:iterate Tag of struts custom tags.

By using this tag you can iterate arraylist of plain java objs,each obj having feild you required
i.e. employee_cod | name | address | phone number.
Inside iterate Tag use html:text tag to display values of variable, that is editable due to text tag used.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am a bit confused that whether i can able to build user friendly applications using struts 2.

Of course you can.

There's no tag for doing exactly what you want, though. There are several options: you can build the table by hand and use JavaScript to handle a row click, or use something like DisplayTag to build the bulk of the table (but I think you'd still have to handle editing etc. with JavaScript, but I'm not really familiar with DisplayTag), or find a third-party open-source or commercial component that does all the work for you.
 
biny panackal
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got it . But i dont know wether it is the actual way to do it...


bean class





fillQuestionList class used to fill the ArrayList






Plain Objec(Pojo) class




JSP Code





It is using an object for each row. Wether it will create problem with garbage collection which in terms reduse the speed of my application .

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Collections of objects are how essentially every single Java application in the world works--objects are the primary way Java stores data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic