I have the following code in 3 files + struts.xml and the .ftl page displays
[errors, mobile, non-parsed] as text unless I remove the comments in file 1. 
I am expecting an actual 3 element list to display on the second action.
(see the partial struts.xml file below)  Do I have the wrong code, idea, or
what?

Thank you for any suggestions!

==========  file 1  .java  =============
public class UserAgentViewsForm {                                               
                                                                                
                    
    private Date startDate;                                                     
                                                                                
                    
    private Date endDate;                                                       
                                                                                
                    
    private List<String> tableList;                                             
                                                                                
                    
    private String table;                                                       
                                                                                
                    
                                                                                
                                                                    
                                                                                
                                                                                
                    
    public UserAgentViewsForm() {                                               
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public UserAgentViewsForm(Date startDate, Date endDate, List<String>
tableList, String table) {                                                      
            
        this.startDate = startDate;                                             
                                                                                
                    
        this.endDate = endDate;                                                 
                                                                                
                    
        this.tableList = tableList;                                             
                                                                                
                    
        this.table = table;                                                     
                                                                                
                    
}                                                                               
                                                                        
                                                                                
                                                                                
                 
                                                                                
                                                                                
                    
    public Date getStartDate() {                                                
                                                                                
                    
        return startDate;                                                       
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public Date getEndDate() {                                                  
                                                                                
                    
        return endDate;                                                         
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public List<String> getTableList() {                                        
                                                                                
                    
        return tableList;                                                       
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public String getTable() {                                                  
                                                                                
                    
        return table;                                                           
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                        
    public void setStartDate(Date startDate) {                                  
                                                                                
                    
        this.startDate = startDate;                                             
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public void setEndDate(Date endDate) {                                      
                                                                                
                    
        this.endDate = endDate;                                                 
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public void setTableList(List<String> tableList) {                          
                                                                                
                    
    /*    these are the comments                                                
                                                                                
                                                 
        if (tableList.size() == 1) {                                            
                                                                                
                    
            String stringList = tableList.get(0);                               
                                                                                
                    
            String subStringList = stringList.substring(1,
stringList.length() - 1);                                                       
                                         
            String[] tList = subStringList.split(",\\s+");                      
                                                                                
                    
                                                                                
                                                                                
                    
            tableList = new ArrayList<String>();                                
                                                                                
                    
            for (int i = 0; i < tList.length; i++) {                            
                                                                                
                    
                tableList.add(tList[i]);                                        
                                                                                
                    
            }                                                                   
                                                                                
                    
        }                                                                       
                                                                                
                    
                                                                                
                                                                                
                    
*/                                                                              
                                                                                
                    
        this.tableList = tableList;                                             
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public void setTable(String table) {                                        
                                                                                
                    
        this.table = table;                                                     
                                                                                
                    
    }
}


========== partial of file 2 =================
    public class TableViewAction extends ActionSupport {                        
                                                                                
                        
    private RegisterDrivers registerDrivers = new RegisterDrivers();            
                                                                                
                    
    private List<TableRecord> recordList;                                       
                                                                                
                    
    private UserAgentViewsForm userAgentViewsForm;                              
                                                                                
                    
    private String startDate;                                                   
                                                                                
                    
    private String endDate;                                                     
                                                                                
                    
                                                                                
                                                                                
                    
    @SkipValidation                                                             
                                                                                
                    
    public String executeInitial() {                                            
                                                                                
                    
        long oneDay = 1000L * 24L * 60L * 60L;                                  
                                                                                
                    
        GregorianCalendar cal = new GregorianCalendar();                        
                                                                                
                    
        long calInMillis = cal.getTimeInMillis();                               
                                                                                
                    
        //userAgentViewsForm = new UserAgentViewsForm(new Date(calInMillis -
91L * oneDay), new Date(calInMillis - oneDay), "mobile", "day");                
                       
        List<String> tL = new ArrayList<String>();                              
                                                                                
                    
        tL.add("errors"); tL.add("mobile"); tL.add("non-parsed");               
                                                                                
                    
        userAgentViewsForm = new UserAgentViewsForm(new Date(calInMillis -
oneDay), new Date(calInMillis - oneDay), tL, "mobile", "day");                  
                         
        startDate = String.format("%1$tY-%1$tm-%1$td",
userAgentViewsForm.getStartDate());                                             
                                             
        endDate = String.format("%1$tY-%1$tm-%1$td",
userAgentViewsForm.getEndDate());                                               
                                               
        setRecordList(userAgentViewsForm.getTable());                           
                                                                                
                    
                                                                                
                                                                                
                    
        return SUCCESS;                                                         
                                                                                
                    
    }                                                                           
                                                                                
                    
                                                                                
                                                                                
                    
    public String execute() {                                                   
                                                                                
                    
        startDate = String.format("%1$tY-%1$tm-%1$td",
userAgentViewsForm.getStartDate());                                             
                                             
        endDate = String.format("%1$tY-%1$tm-%1$td",
userAgentViewsForm.getEndDate());                                               
                                               
                                                                                
                                               
        if (!validateExecute()) {                                               
                                                                                
                    
            return INPUT;                                                       
                                                                                
                    
        }                                                                       
                                                                                
                    
        setRecordList(userAgentViewsForm.getTable());                           
                                                                                
                    
                                                                                
                                                                                
                    
        return SUCCESS;                                                         
                                                                                
                    
    }                                                                           
                                                                                
                    
======= end partial of file 2

======== partial of userAgentViewsForm.ftl ====================
<html>
<head>
<title>User Agent Views Report</title>
</head>
<@s.head/>
<body>
<h1>User Agent Views Report</h1>
<@s.fielderror />
<@s.form
    id="userAgentViewsForm"
    cssStyle="border: 1px solid white; width: 1260px; background: #CCCC99"
    action="runUserAgentViews"
    method="post">

    <@s.datetimepicker
    label="Start Date"
    name="userAgentViewsForm.startDate"
    id="pickerStart"
    tooltip="Select a Start Date after 08/07/2007"
    displayFormat="MM/dd/yyyy"
    />

    <@s.datetimepicker
    label="End Date"
    name="userAgentViewsForm.endDate"
    id="pickerEnd"
    tooltip="Select an End Date before today"
    displayFormat="MM/dd/yyyy"
    />

    <@s.select
    label="Table"
    id="tableId"
    tooltip="Select the Table to Display"
    size="3"
    list="userAgentViewsForm.tableList"  ******* what displays is [errors,
moble, non-parsed] on the 
    name="userAgentViewsForm.table"
    />

    <@s.hidden name="userAgentViewsForm.tableList" />
    <@s.submit value="Submit" align="left" />

</@s.form>
http://devbox.ccbill.com:8080/browserInfo/ Home 
${userAgentViewsForm.tableList}
========== end of partial of file userAgentViewsForm.ftl ==========

                                                                                
                                                                                
                   
===== partial of struts.xml ==============
    <!-- userAgent Views -->                                                    
                                                                                
                    
    <action name="runUserAgentViewsInitial" method="executeInitial"
class="com.ccbill.chart.userAgentViews.action.TableViewAction">                 
                                
        <result
type="freemarker">/pages/userAgentViews/userAgentViewsForm.ftl</result>         
                                                                                
    
    </action>                                                                   
                                                                                
                    
    <action name="runUserAgentViews"
class="com.ccbill.chart.userAgentViews.action.TableViewAction">                 
                                                               
        <result
type="freemarker">/pages/userAgentViews/userAgentViewsForm.ftl</result>         
                                                                                
    
        <result type="freemarker"
name="input">/pages/userAgentViews/userAgentViewsForm.ftl</result>              
                                                                  
    </action> 

===== end partial of struts.xml                                      
-- 
View this message in context: 
http://www.nabble.com/setTableList%28List%3CString%3E-tableList%29-not-working--tp15359772p15359772.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to