« Return to Thread: Struts 2 / DisplayTag example

Re: Struts 2 / DisplayTag example

by Ram Mohan Parvatham :: Rate this Message:

| View in Thread

Hi Patrik,

Please send entire struct 2.x example code to rammohanparvatham@gmail.com.

Advance Thanks,
Ram Mohan

kenk wrote:
Hi Patrik,

That should be easy.  Replace my domain object "TestScenario" with yours: "Order".  Within it, define a boolean property called 'packed'.  In the action where I have "private List<TestScenario> scenarioList;", replace it with "private List<Order> orderList;", with appropriate getters and setters.  Throw away my "private List<Boolean> select;" property, you won't need it.

Then, in DisplayTag, the column for packed would be:
  <display:column title="packed?" >
        <s:checkbox name="orderList[%{#attr.row_rowNum - 1}].packed" />
  </display:column>

 Similar syntax for all of the struts 2 controls, i.e. a text input for the same field would be:

    <s:textfield name="orderList[%{#attr.row_rowNum - 1}].packed />

I think that's it, but I may have made a mistake.  Post back and let me know.

K

 « Return to Thread: Struts 2 / DisplayTag example