Hello,

I have implemented Carlo's approach in my base page and wrapped methods
around it to create page parameters and redirect to the previous page. Thank
you for this contribution.

Everything works just fine, but there are some voices on my team that think
that this approach is unnecessary and overly verbose. Though, no
alternatives are presented.

Is this approach recommended by others on this list? Does anyone have a
pointer to a similar implementation in 1.4 (PageReference?). We are still on
1.3, but it would be interesting.

Thank you,
Kariem



Carlo Camerino wrote:
> 
> Try this
> 
> I have this method for getting the current page id and version.
> 
> protected PageIDVersion getCurrentPageIDVersion() {
>         PageIDVersion pageIDVersion = new
> PageIDVersion(getPageMapEntry().getNumericId(),
> getCurrentVersionNumber());
>         return pageIDVersion;
>   }
> 
> I send it to the next page by using a
> 
> class PageIDVersion {
>     private Integer pageNum;
>     private Integer version;
> }
> 
> I store it as an instance in next page.
> 
> public class NextPage() {
> private pageIdVersion pageIdVersion
> private NextPage(PageIDVersion pageIdVersion) }
>       this.pageIdVersion = pageIDversion;
>    }
> }
> 
> Then use this button to reference the previous page.
> 
> package com.ccti.base.web.components.button;
> 
> import org.apache.wicket.behavior.SimpleAttributeModifier;
> import org.apache.wicket.markup.html.link.Link;
> 
> import com.ccti.base.web.utilities.PageIDVersion;
> 
> /**
>  * @author Carlo M. Camerino
>  *
>  */
> public class BackButton extends Link {
>     private PageIDVersion pageIDVersion;
> 
>     public BackButton(String id, PageIDVersion pageIDVersion) {
>         super(id);
>         this.pageIDVersion = pageIDVersion;
>         add(new SimpleAttributeModifier("value", "Back"));
>     }
> 
>     @Override
>     public void onClick() {
>         setResponsePage(getPage().getPageMap().get(pageIDVersion.getId(),
> pageIDVersion.getVersion()));
>     }
> 
> 
> }
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Possible-to-retrieve-previous-page-from-PageMap-tp20861106p24261680.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to