0

Can someone Tell me, why my Table is rendered the wrong way?

<table class="ListingTable">
        <thead>
            <tr>
                <th style="border-left-style: hidden;">ProjectName</th>
                <th>CustomerID</th>
                <th>Leader</th>
                <th>DeadLine</th>
                <th>Status</th>
                <th style="border-right-style: hidden;"></th>
            </tr>
        </thead>
        <tbody>
            <s:iterator value="projectMaps" status="Statusindex">
                <tr>
                    <td><s:property value="Name" /></td>
                    <td><s:property value="CustomerID" /></td>
                    <td><s:property value="Leader" /></td>
                    <td><s:property value="DeadLine" /></td>
                    <td><s:property value="Status" /></td>
                    <td>
                        <form action="Details.action">
                            <s:hidden id="statusid" name="statusid" value="%{Index}" />
                            <s:submit type="submit" id="%{Index}" value="Details"
                                method="execute" style="height:20px;" />
                        </form>
                    </td>
                </tr>
            </s:iterator>
        </tbody>
    </table>

It should look like this: The pic, of what it should look like

But it looks like this:

How it actually looks

It must be within the <form> </form> because if I comment it out and replace it with just a Button, I get the result from the first picture.

It creates a new <tr> extra for each button, which I don't understand!

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Saggex
  • 3,390
  • 3
  • 22
  • 37
  • 1
    http://struts.apache.org/docs/themes-and-templates.html. – Aleksandr M Jan 14 '15 at 11:02
  • possible duplicate of [How to arrange two butons side by side in Struts2](http://stackoverflow.com/questions/14009470/how-to-arrange-two-butons-side-by-side-in-struts2) – Aleksandr M Jan 14 '15 at 11:03

3 Answers3

1

Use the simple theme to prevent the framework from generating the extra <tr>:

<s:submit type = "submit" 
            id = "%{Index}" 
         value = "Details"
        method = "execute" 
      cssStyle = "height:20px;" 
         theme = "simple" />

Also style should be cssStyle in Struts Tags.

And finally, avoid using DMI (Dynamic Method Invocation, the method="" part) because it is highly discouraged. It is not even needed if the method is execute(), the default one.

Read more about the different ways to set a theme in this answer.

Community
  • 1
  • 1
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
0

add a style to your form display: inline-block;

<form action="Details.action" style="display: inline-block;">
Dheerendra Kulkarni
  • 2,728
  • 1
  • 16
  • 18
0

Put the form outside of the table. Something like this

<form>
   <table>
      ....
   </table>
</form>

and I think there is no use of style="height:20px;" in submit button.

Junaid
  • 2,572
  • 6
  • 41
  • 77