[ 
https://issues.apache.org/jira/browse/TAP5-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shing Hing Man updated TAP5-1796:
---------------------------------

    Attachment: testgeneric-src.jar

Maven project to reproduce the error.
                
> Flash persistence not  working after a zone within a form  is updated in a 
> parameterized page 
> ----------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1796
>                 URL: https://issues.apache.org/jira/browse/TAP5-1796
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Shing Hing Man
>            Priority: Minor
>         Attachments: testgeneric-src.jar
>
>
> In Tapestry 5.3, I have a page PageA  which is  a parameterized page of a 
> generic base page.
> PageA has a form with a zone. Somehow no result is rendered  on the client 
> side if the zone is updated, and then follow by a form  submit. 
> Attached is a maven project to reproduce  my error.
> Steps to reproduce error :  pageA -> choose Audi -> click submit
>                                     (then Audi, A4 are displayed on the 
> bottom of the page)
>                                        --> choose BMW
>                                        -- > click submit
>                                     This time, make and model are both blank  
> at the bottom of the page.                                        
>                                      I was expecting BMW and 3 series to be 
> displayed.
>           
>                                    
>                                      
> public abstract class BasePage<T extends BaseBean>{
>     private Logger log = Logger.getLogger(BasePage.class);
>       
>       @Persist(PersistenceConstants.FLASH)
>       private T bean;
>       
>       @Persist(PersistenceConstants.FLASH)
>       @Property
>       private boolean showOutput;
>       
>       
>       void onSubmitFromForm(){
>               showOutput = true;
>       }
>       
>       public T getBean(){
>                
>               if (bean == null){
>                   bean = createBean();
>                       
>               }
>               return bean;
>       }
>       
>       
>       protected T createBean(){
>               T newInstance = null;
>               
>                   try {
>                       Class<T> clazz = getBeanClass();
>                               newInstance =clazz.newInstance();
>                       } catch (InstantiationException e) {
>                               log.info(e);
>                               
>                       } catch (IllegalAccessException e) {
>                               log.info(e);
>                       }
>               
>           return newInstance;
>       }
>       
>       
>       protected abstract Class<T> getBeanClass();
> }
> ------------
> public class PageA extends BasePage<PageABean> {
>       @InjectComponent
>       private Zone modelZone;
>       @Property
>       @Persist
>       private List<String> availableModels;
>       
>       public Object onValueChanged(CarMaker maker) 
>     {
>        availableModels = findAvailableModels(maker);
>        
>        return modelZone.getBody();
>     }
>     
>     public List<String> findAvailableModels(final CarMaker maker) 
>     {
>       switch (maker) 
>       {
>          case AUDI:
>             return Arrays.asList("A4", "A6", "A8");
>          case BMW:
>             return Arrays.asList("3 Series", "5 Series", "7 Series");
>          case MERCEDES:
>             return Arrays.asList("C-Class", "E-Class", "S-Class");
>          default:
>             return Arrays.asList();
>        }
>     }
>     
>     
>       @Override
>       protected Class<PageABean> getBeanClass() {
>               return PageABean.class;
>       }
>       
> }
> ----------------
> PageA.tml
>      <t:form>
>       <p>
>          <t:errors />
>       </p>
>       <p>
>          Car Marker : <t:select t:id="carMaker" validate="required" 
> value="bean.carMaker"
>                    zone="modelZone" />
>       </p>
>       
>       <t:zone t:id="modelZone" id="modelZone">
>          <t:if test="bean.carMaker">
>            <p>
>               Model : <t:select t:id="carModel" model="availableModels" 
> validate="required" value="bean.model"/>
>            </p>
>          </t:if>
>       </t:zone>
>       
>       <p>
>          <t:submit value="literal:Submit" />
>       </p>
>    </t:form>
>      
>      <t:if test="showOutput">
>            Make = ${bean.carMaker} <br/>
>            model = ${bean.model}
>  
>      </t:if>
>     </body>
> ----------------
> public class PageABean extends BaseBean {
>       public enum CarMaker {
>               MERCEDES, AUDI, BMW;
>       }
>       
>       
>       private CarMaker carMaker;
>       
>       private String model;
>       
>       public String getModel() {              
>               return model;
>       }
>       public void setModel(String model) {
>               this.model = model;
>       }
>       public CarMaker getCarMaker() {
>               return carMaker;
>       }
>       public void setCarMaker(CarMaker carMaker) {
>               this.carMaker = carMaker;
>       }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to