You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Subramanian Murali <su...@gmail.com> on 2009/04/13 10:37:38 UTC

Multiple Versions of HTML for a page/component

Hi,
I understand from the link
http://cwiki.apache.org/WICKET/mobile-devices.html that we can have multiple
versions of html for a page / component like below:

person.html
person_mobile.html

Where / How do i implement which version of html should be chosen based on
some condition?

Moreover, if my mobile version of html doesn't display all the components
defined in the page, How do i render the page?

Do we have options custom rendering mechanisms like we have rendering kits
in JSF?

Thanks in advance for the answers.

Thanks,
Subbu.

Re: Multiple Versions of HTML for a page/component

Posted by Martin Grigorov <mc...@e-card.bg>.
El lun, 13-04-2009 a las 03:37 -0500, Subramanian Murali escribió:
> Hi,
> I understand from the link
> http://cwiki.apache.org/WICKET/mobile-devices.html that we can have multiple
> versions of html for a page / component like below:
> 
> person.html
> person_mobile.html
> 
> Where / How do i implement which version of html should be chosen based on
> some condition?
see the source code of
http://wicketstuff.org/wicket13/hellobrowser/howdy/HelloBrowser/

this is the way to find out which is the user agent. depending on it you
could do:
Session.get().setStyle("mobile")

> 
> Moreover, if my mobile version of html doesn't display all the components
> defined in the page, How do i render the page?
MyPage.html (normal browser):
<html><body> 
<span wicket:id="label1"></span><span wicket:id="label2"></span> 
</body></html>

MyPage_mobile.html (mobile browser):
<html><body> 
<span wicket:id="label1"></span> 
</body></html>

MyPage.java -> constructor:

public MyPage(PageParameters pp) {

  add(new Label("label1", "We be shown on both browser types");

  if (!"mobile".equals(Session.get().getStyle()) {
    add(new Label("label2", "Only for normal browsers");
  }

}

> 
> Do we have options custom rendering mechanisms like we have rendering kits
> in JSF?
See above
> 
> Thanks in advance for the answers.
> 
> Thanks,
> Subbu.


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