Have a look at CompoundPropertyModel, or BoundCompoundPropertyModel.
The different models are explained in details here :
http://cwiki.apache.org/WICKET/working-with-wicket-models.html




2007/11/22, Gervais <[EMAIL PROTECTED]>:
>
> Ho.. yes it is possible. .. really i'm a stupid boy !
>
> But is it also possible to give one model for all content of the page ?
>
>     public class MyPage extends WebPage {
>
>         public MyPage(PageModel model) {
>
>            add(new Label("welcome", model));
>            add(new ExternalLink("toGoogle", model));
>
>         }
>     }
>
> Maybe, this klind of model already exist ? If not what existing model
> can i extend or implements to do that ?
> Also is it possible to give objects to page by a setter ? I suppose that
> it isn't beacause page was rendered after the constructor.
>
>
> Dipu Seminlal a écrit :
> > Is it not possible to pass those objects itself to the page in the
> constructor.
> > Thats how i do it, may be i don't understand your problem correctly,
> > hopefully someone else here will be able to help you.
> >
> > regards
> > dipu
> >
> >
> >
> > On Nov 22, 2007 4:01 PM, Gervais <[EMAIL PROTECTED]> wrote:
> >
> >> Ho, yes i imagine it like that.
> >>
> >> But in my case, and i suppose many other, i get information from many
> >> object/beans that contains values stored in database.
> >>
> >> In fact i surrely use two java.util.List (Annoucements and Notes) and
> >> other objects for paragraph and links but i don't now what kinds of
> >> objects. Must i create one class per non static item to be displayed ?
> >>
> >> Dipu Seminlal a écrit :
> >>
> >>
> >>> Is the content of your  page (paragraph, links, list etc ) static in
> >>> nature, then you can just write it directly in html,
> >>>
> >>> If it is not static in nature where do you get it from and in what
> form
> >>>
> >>> If you have an object that is initialised with the data to populate in
> >>> you StartupPage, you can have a constructor like the following
> >>>
> >>> public StartupPage(YourStartupContentObject foo)
> >>> {
> >>>        add(new Label("message1", foo.getMessage1()));
> >>>       add(new Label("message2", foo.getMessage2()));
> >>>
> >>>       add(new MultilineLabel("message2", foo.getparagraph()));
> >>> }
> >>>
> >>> Or
> >>>
> >>> public StartupPage()
> >>> {
> >>>        YourStartupContentObject foo = fetchTheContent();
> >>>        add(new Label("message1", foo.getMessage1()));
> >>>       add(new Label("message2", foo.getMessage2()));
> >>>
> >>>       add(new MultilineLabel("message2", foo.getparagraph()));
> >>> }
> >>>
> >>> Hope you get the Idea
> >>>
> >>> regards
> >>> dipu
> >>>
> >>> On Nov 22, 2007 3:23 PM, Gervais <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>> Ok thanks.
> >>>>
> >>>> But y have another question. (i try to translate it corretcly).
> >>>>
> >>>> For beginning i have created an application named "Startup" with one
> >>>> page named "StartupPage".
> >>>> Below is my "StartupPage" code :
> >>>>
> >>>> # Code start
> >>>>
> ------------------------------------------------------------------------------------------------------
> >>>> public class StartupPage extends WebPage {
> >>>>
> >>>>     private TestBean bean;
> >>>>
> >>>>     public StartupPage() {
> >>>>
> >>>>         bean=new TestBean();
> >>>>         bean.setWelcome("Welcome text bla bla bla");
> >>>>
> >>>>         add(new Label("test", new PropertyMdel(bean, "welcome") ));
> >>>>
> >>>>     }
> >>>> }
> >>>> # Code end
> >>>>
> ------------------------------------------------------------------------------------------------------
> >>>>
> >>>> It works great but my page "StartupPage.html" must contains more than
> >>>> one welcome message.
> >>>> - Must i have one attribute (in my bean) per item to display ?
> >>>> - If i must have one attribute in my bean per item to display, it
> become
> >>>> a Model. If it become a model it must implements or extends a model.
> >>>> What model ?
> >>>> --> How can i correctly create a page that contains "only" paragraph,
> >>>> links and list ?
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Dipu Seminlal a écrit :
> >>>>
> >>>>
> >>>>
> >>>>> We don't do imports, we extends ! checkout markup inheritance
> >>>>>
> >>>>> http://cwiki.apache.org/WICKET/markup-inheritance.html
> >>>>>
> >>>>> regards
> >>>>> dipu
> >>>>>
> >>>>> On Nov 22, 2007 2:48 PM, Gervais <[EMAIL PROTECTED]> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>> Hy all,
> >>>>>>
> >>>>>> I'm new in the famous wicket world ! I need to start learning
> Wicket but
> >>>>>> i can't found docs that explain more than just doing a HelloWrold
> or a
> >>>>>> GuestBook.
> >>>>>> In fact i need to use Wicket with Spring but for that i first need
> to
> >>>>>> understand and play with wicket. So i have many questions.
> >>>>>>
> >>>>>> 1° Is there a way for stupid frenchies that don't speak english
> like me
> >>>>>> to talk about Wicket ? (If not sorry for my poor english)
> >>>>>>
> >>>>>>
> >>>>>> 2° How can i import other page. Like a <%@ include
> >>>>>> file="includes/menubar.inc.jsp" %> or <jsp:include
> >>>>>> page="includes/menubar.inc.jsp" flush="true" /> tag ?
> >>>>>>
> >>>>>> 3° In a big form ( with more than 20 fields ) that represnet more
> than
> >>>>>> one Pojo Bean how must i work ?
> >>>>>>
> >>>>>>
> >>>>>> Thanks
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>
> >>>>>
> >>>>>
> >>>>> __________ NOD32 2678 (20071122) Information __________
> >>>>>
> >>>>> This message was checked by NOD32 antivirus system.
> >>>>> http://www.eset.com
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>> __________ NOD32 2678 (20071122) Information __________
> >>>
> >>> This message was checked by NOD32 antivirus system.
> >>> http://www.eset.com
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > __________ NOD32 2678 (20071122) Information __________
> >
> > This message was checked by NOD32 antivirus system.
> > http://www.eset.com
> >
> >
> >
> >
>

Reply via email to