You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Justin Chin <ju...@justinchin.com> on 2012/06/30 00:46:21 UTC

Struts Tag Iterator formatting issue using tables

I am having issues getting the Struts Iterator Tag to format 
correctly.Any help would greatly be appreciated as this seems very 
simple, but clearly I missing something:

Here is my jsp:

<%@page language=/"java"/ contentType=/"text/html; charset=UTF-8" 
/pageEncoding=/"UTF-8"/%>

<%@taglib prefix=/"s"/ uri=/"/struts-tags"/%>

<html>

<head>

<title>Bulk Terminate</title>

</head>

<body>

<h1>Bulk Terminate</h1>

<tableborder=/"1"/ "width=/"100%"/>

<tr>

<td>Select User</td>

<td>Full Name</td>

<td>Job Title</td>

</tr>

<tr>

<s:iteratorvalue=/"peopleList"/>

<tr>

<td><s:checkboxname=/"fullName"/ /></td>

<td><s:propertyvalue=/"fullName"/ /></td>

<td><s:propertyvalue=/"jobTitle"/ /></td>

</tr>

</s:iterator>

</tr>

</table>

</body>

</html>


This is what it looks like in a browser:

And here is the HTML code source:

<html>

<head>

<title>Bulk Terminate</title>

</head>

<body>

<h1>Bulk Terminate</h1>

<table border="1" "width="100%">

<tr>

<td>Select User</td>

<td>Full Name</td>

<td>Job Title</td>

</tr>

<tr>

<tr>

<td>

<tr>

<td valign="top" align="right">

</td>

<td valign="top" align="left">

<input type="checkbox" name="fullName" value="true" id="fullName" 
/><input type="hidden" id="__checkbox_fullName" 
name="__checkbox_fullName" value="true" />

</td>

</tr>

</td>

<td>John Doe0</td>

<td>Job Title0</td>

</tr>

<tr>

<td>

<tr>

<td valign="top" align="right">

</td>

<td valign="top" align="left">

<input type="checkbox" name="fullName" value="true" id="fullName" 
/><input type="hidden" id="__checkbox_fullName" 
name="__checkbox_fullName" value="true" />

</td>

</tr>

</td>

<td>John Doe1</td>

<td>Job Title1</td>

</tr>

<tr>

<td>

<tr>

<td valign="top" align="right">

</td>

<td valign="top" align="left">

<input type="checkbox" name="fullName" value="true" id="fullName" 
/><input type="hidden" id="__checkbox_fullName" 
name="__checkbox_fullName" value="true" />

</td>

</tr>

</td>

<td>John Doe2</td>

<td>Job Title2</td>

</tr>

</tr>

</table>

</body>

</html>

Where did all the extra table rows and table cells come from?


Re: Struts Tag Iterator formatting issue using tables

Posted by Dave Newton <da...@gmail.com>.
Two issues: form elements with no form, and using the default xhtml theme,
where form element tags include table rows/cells.

You may want to use the "simple" theme, or create/extend a theme.

Note the simple theme doesn't emit field errors.

Dave

(pardon brevity and typos, on cell)
On Jun 29, 2012 6:47 PM, "Justin Chin" <ju...@justinchin.com> wrote:

>  I am having issues getting the Struts Iterator Tag to format correctly.  Any
> help would greatly be appreciated as this seems very simple, but clearly I
> missing something:****
>
> Here is my jsp:****
>
> <%@ page language=*"java"* contentType=*"text/html; charset=UTF-8" *
> pageEncoding=*"UTF-8"*%>****
>
> <%@ taglib prefix=*"s"* uri=*"/struts-tags"*%>****
>
> <html>****
>
> <head>****
>
> <title>Bulk Terminate</title>****
>
> </head>****
>
> ** **
>
> <body>****
>
> <h1>Bulk Terminate</h1>****
>
> ** **
>
> <table border=*"1"* "width=*"100%"*>****
>
>       <tr>****
>
>             <td>Select User</td>****
>
>             <td>Full Name</td>****
>
>             <td>Job Title</td>****
>
>       </tr>****
>
>       <tr>****
>
>             <s:iterator value=*"peopleList"*>****
>
>                   <tr>****
>
>                         <td><s:checkbox name=*"fullName"* /></td>****
>
>                         <td><s:property value=*"fullName"* /></td>****
>
>                         <td><s:property value=*"jobTitle"* /></td>****
>
>                   </tr>****
>
>             </s:iterator>****
>
>       </tr>****
>
> </table>****
>
> </body>****
>
> </html>****
>
> **
> **
>
> This is what it looks like in a browser:****
>
> ****
>
> ** **
>
> And here is the HTML code source:****
>
> <html>****
>
>    <head>****
>
>       <title>Bulk Terminate</title>****
>
>    </head>****
>
>    <body>****
>
>       <h1>Bulk Terminate</h1>****
>
>       <table border="1" "width="100%">****
>
>          <tr>****
>
>             <td>Select User</td>****
>
>             <td>Full Name</td>****
>
>             <td>Job Title</td>****
>
>          </tr>****
>
>          <tr>****
>
>          <tr>****
>
>             <td>****
>
>          <tr>****
>
>             <td valign="top" align="right">****
>
>             </td>****
>
>             <td valign="top" align="left">****
>
>                <input type="checkbox" name="fullName" value="true"
> id="fullName" /><input type="hidden" id="__checkbox_fullName"
> name="__checkbox_fullName" value="true" /> ****
>
>             </td>****
>
>          </tr>****
>
>          </td>****
>
>          <td>John Doe0</td>****
>
>          <td>Job Title0</td>****
>
>          </tr>****
>
>          <tr>****
>
>             <td>****
>
>          <tr>****
>
>             <td valign="top" align="right">****
>
>             </td>****
>
>             <td valign="top" align="left">****
>
>                <input type="checkbox" name="fullName" value="true"
> id="fullName" /><input type="hidden" id="__checkbox_fullName"
> name="__checkbox_fullName" value="true" /> ****
>
>             </td>****
>
>          </tr>****
>
>          </td>****
>
>          <td>John Doe1</td>****
>
>          <td>Job Title1</td>****
>
>          </tr>****
>
>          <tr>****
>
>             <td>****
>
>          <tr>****
>
>             <td valign="top" align="right">****
>
>             </td>****
>
>             <td valign="top" align="left">****
>
>                <input type="checkbox" name="fullName" value="true"
> id="fullName" /><input type="hidden" id="__checkbox_fullName"
> name="__checkbox_fullName" value="true" /> ****
>
>             </td>****
>
>          </tr>****
>
>          </td>****
>
>          <td>John Doe2</td>****
>
>          <td>Job Title2</td>****
>
>          </tr>****
>
>          </tr>****
>
>       </table>****
>
>    </body>****
>
> </html>****
>
> ** **
>
> Where did all the extra table rows and table cells come from?****
>

RE: Struts Tag Iterator formatting issue using tables

Posted by Martin Gainty <mg...@hotmail.com>.
try this package org.apache.struts2.example;public class Bean {
    protected String FullName;
    protected String Title;}
<s:bean name="org.apache.struts2.example.Bean" var="listPeople">
  <s:param name="FullName" value="'GIJoe'"/>
  <s:param name="Title" value="'AmericanIndenturedServant'"/>
</s:bean>
 <s:iterator value="listPeople" status="groupStatus">
         <td><s:property value="FullName" /></td>
         <td><s:property value="Title" /></td>
     </tr>
 </s:iterator>

Martin ______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 Date: Fri, 29 Jun 2012 18:46:21 -0400
From: justin@justinchin.com
To: user@struts.apache.org
Subject: Struts Tag Iterator formatting issue using tables


  
    
  
  
    
    


    I am having issues getting the Struts Iterator
      Tag to format correctly.  Any
      help would greatly be appreciated as this seems very simple, but
      clearly I missing something:
    Here is my jsp:
    
      
        
          
            <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
            <%@ taglib prefix="s" uri="/struts-tags"%>
            <html>
            <head>
            <title>Bulk Terminate</title>
            </head>
             
            <body>
            <h1>Bulk Terminate</h1>
             
            <table border="1" "width="100%">
                 

                <tr>
                       

                <td>Select User</td>
                       

                <td>Full Name</td>
                       

                <td>Job Title</td>
                 

                </tr>
                 

                <tr>
                       

                <s:iterator value="peopleList">
                             

                <tr>
                                   

                <td><s:checkbox name="fullName" /></td>
                                   

                <td><s:property value="fullName" /></td>
                                   

                <td><s:property value="jobTitle" /></td>
                             

                </tr>
                       

                </s:iterator>
                 

                </tr>
            </table>
            </body>
            </html>
          
        
      
    
      

      
    This is what it looks like in a browser:
    
      
        
          
            
          
        
      
    
     
    And here is the HTML code source:
    
      
        
          
            <html>
               <head>
                  <title>Bulk


              Terminate</title>
               </head>
               <body>
                  <h1>Bulk


              Terminate</h1>
                  <table


              border="1" "width="100%">
                     <tr>
                        <td>Select


              User</td>
                        <td>Full


              Name</td>
                        <td>Job


              Title</td>
                     </tr>
                     <tr>
                     <tr>
                        <td>
                     <tr>
                        <td


              valign="top" align="right">
                        </td>
                        <td


              valign="top" align="left">
                           <input


              type="checkbox" name="fullName" value="true" id="fullName"
              /><input type="hidden" id="__checkbox_fullName"
              name="__checkbox_fullName" value="true" /> 
                        </td>
                     </tr>
                     </td>
                     <td>John


              Doe0</td>
                     <td>Job


              Title0</td>
                     </tr>
                     <tr>
                        <td>
                     <tr>
                        <td


              valign="top" align="right">
                        </td>
                        <td


              valign="top" align="left">
                           <input


              type="checkbox" name="fullName" value="true" id="fullName"
              /><input type="hidden" id="__checkbox_fullName"
              name="__checkbox_fullName" value="true" /> 
                        </td>
                     </tr>
                     </td>
                     <td>John


              Doe1</td>
                     <td>Job


              Title1</td>
                     </tr>
                     <tr>
                        <td>
                     <tr>
                        <td


              valign="top" align="right">
                        </td>
                        <td


              valign="top" align="left">
                           <input


              type="checkbox" name="fullName" value="true" id="fullName"
              /><input type="hidden" id="__checkbox_fullName"
              name="__checkbox_fullName" value="true" /> 
                        </td>
                     </tr>
                     </td>
                     <td>John


              Doe2</td>
                     <td>Job


              Title2</td>
                     </tr>
                     </tr>
                  </table>
               </body>
            </html>
          
        
      
    
     
    Where did all the extra table rows and table
      cells come from?