2

I use display tag for displaying data in table form. We want to add new editable row for adding new records in the table. If the table is having one or more records, I am able to add an editable row at the end of the table and save.

How to add a new editable row in case the table is not having any records?

  • I added editable row in finish row,but it is not getting called when list is empty.how to achieve this using decorator? give more details. – user3359073 Mar 18 '14 at 06:09
  • go through this...http://www.dzone.com/tutorials/java/struts/struts-example/struts-display-tag-table-decorator-example-1.html – earthmover Mar 18 '14 at 06:16
  • We have already used decorator to added the editable row in finishrow method, but it is not getting called when list is empty.can you give sample code how to achieve this – user3359073 Mar 18 '14 at 06:24
  • if your list is empty then you should not get any row in your table, to achieve this, you can use `` and `` – earthmover Mar 18 '14 at 06:29

1 Answers1

2

You may try this:

<s:if test="%{list.size == 0}">
// create an HTML table with an <input> in a column to add records
</s:if>
<s:else>
// your display table with decorator to add new records
</s:else>
earthmover
  • 4,395
  • 10
  • 43
  • 74
  • Is there any possible way to call startRow() and finishRow() methods when the list is empty.cant we call decorator class when the list object is empty. Just to know whether it is possible to achieve in decorator itself rather than moving to html control – Monicka Akilan Mar 18 '14 at 06:33
  • Sorry, I don't know about these methods...:(:(:( – earthmover Mar 18 '14 at 06:37