You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by janneru <ja...@googlemail.com> on 2009/01/29 11:14:13 UTC

migration from jsf to wicket

we are on the way to migrate our old struts web app to something more
modern.
our first try was seam/jsf, but the performance of jsf was very
disappointing.

so now our plan is to use seam (as we like its component model and the
performance was quite good - after using @BypassInterceptors....) with
wicket;
on the one hand we are very impressed by wicket's java-centric approach, on
the other hand we have a lack of understanding of how to achieve some basic
things with wicket, as our experience comes from jsp and jsf.

there are some problems that we didnt find an elegant solution for with
wicket, perhaps somebody can help us to understand the wicket way...


1) working with many attributes of an object
we have some pages where we access many attributes of an object, say we want
to show all 20 attributes of a person and all 10 attributes of
person.getAddress();
in the PersonPage.java i would have to add 30 label (or input) components,
30 lines with nearly identical java code: add(new Label("firstName",
person.getName() );
isn't it tedious to always keep PersonDetails.java and PersonDetails.html
files in sync? in jsf/jsp the changes are only in the jsp/xhtml

2) page composition
in  tiles and facelet compositions the layout is separated in templates
(with navigation, sidebars, header, footers, ...) that decorate the concrete
pages (eg the personDetails page); its possible that the concrete page
(personDetail.xhtml) defines some content of the decoration, e.g. that the
window title of the template should be replaced with: "<title>Details of ${
person.name}</title>";
in the template i would write <title><tiles:insert
name="windowTitle"/></title> with tiles or  <ui:insert name="windowTitle"/>
in facelets;
the content for windowTitle is defined in personDetails.xhtml or in the
tiles definition for the personDetails.jsp

3) preview functionality
is this right: as soon as we use page composition and components, the
preview feature is gone; how do you experienced wicket users handle this? is
it usable in a prototype phase - before the html prototype is decomposed
into composition parts and components?

is there a resource on the web that helps with the task of migrating from
jsf to wicket?
the only one i know is the seam-booking example with the two versions; a
migration guide could be a motivation for jsf users to try out wicket (and
find out thats it better... :-) .

thanx in advance, uwe!

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


Re: migration from jsf to wicket

Posted by uwe janner <uj...@googlemail.com>.
again thx to all the people so helpful on this mailing list!! this fact was
an important argument to  convince my customer to take wicket into account!

i migrated a little part of our old struts1 app  to both seam/jsf and
seam/wicket to compare the performance degradation when going from naked
struts to a component oriented framework;

jsf managed to serve 20 pages per second, wicket was the clear winner with
100 pages / second!
see my comment on
http://ptrthomas.wordpress.com/2009/01/14/seam-jsf-vs-wicket-performance-comparison/#comment-13386

wicket is really great in providing high level web development without
sacrificing performance!!

cheers, uwe!

On Thu, Jan 29, 2009 at 8:04 PM, dtoffe <dt...@yahoo.com.ar> wrote:

>
>    For 1) I suggest you to take a look at Wicket Web Beans:
>
>  http://wicketwebbeans.sourceforge.net/
>
> Cheers,
>
> Daniel
>
>
>
> janneru wrote:
> >
> > martin & john,
> >
> > thank you very much for your ideas!
> > this helps me very much to make the next steps, i will post the results
> > when
> > the integration is done!
> >
> > bestregards, uwe!
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/migration-from-jsf-to-wicket-tp21724080p21733565.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: migration from jsf to wicket

Posted by dtoffe <dt...@yahoo.com.ar>.
    For 1) I suggest you to take a look at Wicket Web Beans:

  http://wicketwebbeans.sourceforge.net/

Cheers,

Daniel



janneru wrote:
> 
> martin & john,
> 
> thank you very much for your ideas!
> this helps me very much to make the next steps, i will post the results
> when
> the integration is done!
> 
> bestregards, uwe!
> 
> 

-- 
View this message in context: http://www.nabble.com/migration-from-jsf-to-wicket-tp21724080p21733565.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: migration from jsf to wicket

Posted by janneru <ja...@googlemail.com>.
martin & john,

thank you very much for your ideas!
this helps me very much to make the next steps, i will post the results when
the integration is done!

bestregards, uwe!

On Thu, Jan 29, 2009 at 11:41 AM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> > 1) working with many attributes of an object
> > we have some pages where we access many attributes of an object, say we
> want
> > to show all 20 attributes of a person and all 10 attributes of
> > person.getAddress();
> > in the PersonPage.java i would have to add 30 label (or input)
> components,
> > 30 lines with nearly identical java code: add(new Label("firstName",
> > person.getName() );
> > isn't it tedious to always keep PersonDetails.java and PersonDetails.html
> > files in sync? in jsf/jsp the changes are only in the jsp/xhtml
>
> There are few options that come into my mind:
> 1. add(new Label(CONSTANT_FIRST_NAME, person.getName() ); // Now you
> can re-use your constant from WicketTests.
> 2. add(new Label(CONSTANT_FIRST_NAME, new PropertyModel(person,
> Person.NAME_CONSTANT) ); // Now you can re-use your Entity's NAME
> -constant from JPA/ORM/Hibernate queries.
> 3. use CompoundPropertyModels. Yes. You will have to sync the names in
> html and in Java. Maybe someone will develop a nice plugin that
> automates this in the future:
>
> http://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-CompoundPropertyModels
> http://cwiki.apache.org/WICKET/more-on-models.html
>
> > 2) page composition
> You can treat Title just as a Label. See <wicket:head> tag and Wicket
> modularity:
> http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html
> http://www.javalobby.org/java/forums/t60926.html
>
> http://cwiki.apache.org/WICKET/create-dynamic-markup-hierarchies-using-panels.html
>
> > 3) preview functionality
> > is this right: as soon as we use page composition and components, the
> > preview feature is gone; how do you experienced wicket users handle this?
> is
> > it usable in a prototype phase - before the html prototype is decomposed
> > into composition parts and components?
>
> The runtime page hierarchy is ofcourse visible only at runtime, but
> you can preview each panel separately ofcourse (if it makes sense).
>
> > is there a resource on the web that helps with the task of migrating from
> > jsf to wicket?
>
> I would save the html files using a browser (if the html markup is not
> available separately) and just pick up from there, starting to add
> wicket:id's to the components of the page, one-by-one (in development
> & debug mode it is quite fast as you do not need to restart the jetty
> server after saved&compiled change).
>
> my 2 cents ;)
>
> **
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: migration from jsf to wicket

Posted by John Krasnay <jo...@krasnay.ca>.
On Thu, Jan 29, 2009 at 12:41:31PM +0200, Martin Makundi wrote:
> > 1) working with many attributes of an object
> > we have some pages where we access many attributes of an object, say we want
> > to show all 20 attributes of a person and all 10 attributes of
> > person.getAddress();
> > in the PersonPage.java i would have to add 30 label (or input) components,
> > 30 lines with nearly identical java code: add(new Label("firstName",
> > person.getName() );
> > isn't it tedious to always keep PersonDetails.java and PersonDetails.html
> > files in sync? in jsf/jsp the changes are only in the jsp/xhtml
> 
> There are few options that come into my mind:
> 1. add(new Label(CONSTANT_FIRST_NAME, person.getName() ); // Now you
> can re-use your constant from WicketTests.
> 2. add(new Label(CONSTANT_FIRST_NAME, new PropertyModel(person,
> Person.NAME_CONSTANT) ); // Now you can re-use your Entity's NAME
> -constant from JPA/ORM/Hibernate queries.
> 3. use CompoundPropertyModels. Yes. You will have to sync the names in
> html and in Java. Maybe someone will develop a nice plugin that
> automates this in the future:
> http://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-CompoundPropertyModels
> http://cwiki.apache.org/WICKET/more-on-models.html
> 

RepeatingView can also come in handy...

  RepeatingView rv = new RepeatingView("field");
  add(rv);
  String[] props = { "firstName", "lastName", ... };
  for (String prop : props) {
    rv.add(new Label(rv.newChildId(), new PropertyModel(person, prop));
  }

If you have something more complex than a Label, just substitute your
own custom panel.

> > 2) page composition
> You can treat Title just as a Label. See <wicket:head> tag and Wicket
> modularity:
> http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html
> http://www.javalobby.org/java/forums/t60926.html
> http://cwiki.apache.org/WICKET/create-dynamic-markup-hierarchies-using-panels.html
> 

One common approach is to use markup inheritance, then have the parent
class expose overridable methods.

  public abstract class BasePage extends WebPage {

    public BasePage() {
      add(new Label("title", new AbstractReadOnlyModel() {
        public Object getObject() {
          return getPageTitle();
        }
      }));
    }

    public abstract String getPageTitle();
  }

  public class PersonPage extends BasePage {

    public PersonPage(PageParameters pp) {
      // load person object based on pp
    }

    public String getPageTitle() {
      return getPerson().getName();
    }
  }

The trick here is to avoid calling the overridable method directly from
the base class constructor (else we'd call PersonPage.getPageTitle
before the person was loaded). That's what the AbstractReadOnlyMethod
thing is about.

> > 3) preview functionality
> > is this right: as soon as we use page composition and components, the
> > preview feature is gone; how do you experienced wicket users handle this? is
> > it usable in a prototype phase - before the html prototype is decomposed
> > into composition parts and components?
> 
> The runtime page hierarchy is ofcourse visible only at runtime, but
> you can preview each panel separately ofcourse (if it makes sense).
> 

It's important to note that everything outside the <wicket:extend> tag
(for markup inheritance) or the <wicket:panel> tag (for panels) is
ignored by Wicket. You can therefore use this to create a reasonable
harness for previewing...

  <html>
    <head>
      <!-- normally included by BasePage, we include it 
           here to enable preview -->
      <link rel="stylesheet" href="../BasePage.css"/>
    </head>
    <body>
      <h1>My Panel Preview</h1>
      <wicket:panel>
        ...
      </wicket:panel>
    </body>
  </html>

But ultimately the point of a component-based framework is to avoid
copying boilerplate around, so if you're looking for previews of
fully-formed pages you're doing it wrong.

jk

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


Re: migration from jsf to wicket

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> 1) working with many attributes of an object
> we have some pages where we access many attributes of an object, say we want
> to show all 20 attributes of a person and all 10 attributes of
> person.getAddress();
> in the PersonPage.java i would have to add 30 label (or input) components,
> 30 lines with nearly identical java code: add(new Label("firstName",
> person.getName() );
> isn't it tedious to always keep PersonDetails.java and PersonDetails.html
> files in sync? in jsf/jsp the changes are only in the jsp/xhtml

There are few options that come into my mind:
1. add(new Label(CONSTANT_FIRST_NAME, person.getName() ); // Now you
can re-use your constant from WicketTests.
2. add(new Label(CONSTANT_FIRST_NAME, new PropertyModel(person,
Person.NAME_CONSTANT) ); // Now you can re-use your Entity's NAME
-constant from JPA/ORM/Hibernate queries.
3. use CompoundPropertyModels. Yes. You will have to sync the names in
html and in Java. Maybe someone will develop a nice plugin that
automates this in the future:
http://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-CompoundPropertyModels
http://cwiki.apache.org/WICKET/more-on-models.html

> 2) page composition
You can treat Title just as a Label. See <wicket:head> tag and Wicket
modularity:
http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html
http://www.javalobby.org/java/forums/t60926.html
http://cwiki.apache.org/WICKET/create-dynamic-markup-hierarchies-using-panels.html

> 3) preview functionality
> is this right: as soon as we use page composition and components, the
> preview feature is gone; how do you experienced wicket users handle this? is
> it usable in a prototype phase - before the html prototype is decomposed
> into composition parts and components?

The runtime page hierarchy is ofcourse visible only at runtime, but
you can preview each panel separately ofcourse (if it makes sense).

> is there a resource on the web that helps with the task of migrating from
> jsf to wicket?

I would save the html files using a browser (if the html markup is not
available separately) and just pick up from there, starting to add
wicket:id's to the components of the page, one-by-one (in development
& debug mode it is quite fast as you do not need to restart the jetty
server after saved&compiled change).

my 2 cents ;)

**
Martin

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