You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2015/09/08 08:23:45 UTC
[jira] [Closed] (TAP5-1796) Flash persistence not working after a
zone within a form is updated in a parameterized page
[ https://issues.apache.org/jira/browse/TAP5-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jochen Kemnade closed TAP5-1796.
--------------------------------
Resolution: Not A Problem
If you still think that there's a bug, please reopen this issue.
> 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, 5.4
> 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.
>
>
> {code}
> 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();
> }
> {code}
> ------------
> {code}
> 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;
> }
>
> }
> {code}
> ----------------
> PageA.tml
> {code}
> <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>
> {code}
> ----------------
> {code}
> 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;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)