You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bushby <mi...@yahoo.com> on 2007/10/18 22:06:48 UTC
Implementation question of WebMarkupContainer
I have a use case where an admin manages html for the user side of an
application. The html is stored in the database. When the user selects a
link from a menu the html is then pulled from the database and displayed.
I have created a custom object extending WebMarkupContainer. I override the
onComponentTagBody method to get the response object and write the html to
the response. Is this the correct way to do this?, meaning clean and
reusable, or should I be looking at creating a resource and adding it with
the application object.
Thanks
Bushby
--
View this message in context: http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13282634
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: Implementation question of WebMarkupContainer
Posted by Martijn Dashorst <ma...@gmail.com>.
Read up on models [1].
The user selects a menu item, so probably your page has something like this:
class mypage extends webpage {
private MenuItem selectedMenuItem = null;
}
If the menuitem class has a property called "itemMarkup" you can do this:
add(new Label("contents", new PropertyModel(mypage.this,
"selectedMenuItem.itemMarkup")).setEscapeModelStrings(false));
Martijn
On 10/18/07, Bushby <mi...@yahoo.com> wrote:
>
> I missed a piece of the functionality. If the user were to select another
> menu item, I need to replace the html. So I could create a new label with
> the new html, replace the label within the container, and then render the
> container?
>
> Thanks
> Bushby
>
>
> Martijn Dashorst wrote:
> >
> > Use:
> >
> > add(new Label("contents",
> > contentsFromDatabase).setEscapeModelStrings(false)));
> >
> > instead.
> >
> > Martijn
> >
> > On 10/18/07, Bushby <mi...@yahoo.com> wrote:
> >>
> >> I have a use case where an admin manages html for the user side of an
> >> application. The html is stored in the database. When the user selects
> >> a
> >> link from a menu the html is then pulled from the database and displayed.
> >>
> >> I have created a custom object extending WebMarkupContainer. I override
> >> the
> >> onComponentTagBody method to get the response object and write the html
> >> to
> >> the response. Is this the correct way to do this?, meaning clean and
> >> reusable, or should I be looking at creating a resource and adding it
> >> with
> >> the application object.
> >>
> >> Thanks
> >> Bushby
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13282634
> >> 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
> >>
> >>
> >
> >
> > --
> > Buy Wicket in Action: http://manning.com/dashorst
> > Apache Wicket 1.3.0-beta4 is released
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13283133
> 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
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Implementation question of WebMarkupContainer
Posted by Frank Bille <fr...@apache.org>.
Use a model on the label instead. If the content changes the label will pull
the latest from the model.
Frank
On 10/18/07, Bushby <mi...@yahoo.com> wrote:
>
>
> I missed a piece of the functionality. If the user were to select another
> menu item, I need to replace the html. So I could create a new label with
> the new html, replace the label within the container, and then render the
> container?
>
> Thanks
> Bushby
>
>
> Martijn Dashorst wrote:
> >
> > Use:
> >
> > add(new Label("contents",
> > contentsFromDatabase).setEscapeModelStrings(false)));
> >
> > instead.
> >
> > Martijn
> >
> > On 10/18/07, Bushby <mi...@yahoo.com> wrote:
> >>
> >> I have a use case where an admin manages html for the user side of an
> >> application. The html is stored in the database. When the user
> selects
> >> a
> >> link from a menu the html is then pulled from the database and
> displayed.
> >>
> >> I have created a custom object extending WebMarkupContainer. I override
> >> the
> >> onComponentTagBody method to get the response object and write the html
> >> to
> >> the response. Is this the correct way to do this?, meaning clean and
> >> reusable, or should I be looking at creating a resource and adding it
> >> with
> >> the application object.
> >>
> >> Thanks
> >> Bushby
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13282634
> >> 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
> >>
> >>
> >
> >
> > --
> > Buy Wicket in Action: http://manning.com/dashorst
> > Apache Wicket 1.3.0-beta4 is released
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13283133
> 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: Implementation question of WebMarkupContainer
Posted by Bushby <mi...@yahoo.com>.
I missed a piece of the functionality. If the user were to select another
menu item, I need to replace the html. So I could create a new label with
the new html, replace the label within the container, and then render the
container?
Thanks
Bushby
Martijn Dashorst wrote:
>
> Use:
>
> add(new Label("contents",
> contentsFromDatabase).setEscapeModelStrings(false)));
>
> instead.
>
> Martijn
>
> On 10/18/07, Bushby <mi...@yahoo.com> wrote:
>>
>> I have a use case where an admin manages html for the user side of an
>> application. The html is stored in the database. When the user selects
>> a
>> link from a menu the html is then pulled from the database and displayed.
>>
>> I have created a custom object extending WebMarkupContainer. I override
>> the
>> onComponentTagBody method to get the response object and write the html
>> to
>> the response. Is this the correct way to do this?, meaning clean and
>> reusable, or should I be looking at creating a resource and adding it
>> with
>> the application object.
>>
>> Thanks
>> Bushby
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13282634
>> 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
>>
>>
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13283133
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: Implementation question of WebMarkupContainer
Posted by Martijn Dashorst <ma...@gmail.com>.
Use:
add(new Label("contents", contentsFromDatabase).setEscapeModelStrings(false)));
instead.
Martijn
On 10/18/07, Bushby <mi...@yahoo.com> wrote:
>
> I have a use case where an admin manages html for the user side of an
> application. The html is stored in the database. When the user selects a
> link from a menu the html is then pulled from the database and displayed.
>
> I have created a custom object extending WebMarkupContainer. I override the
> onComponentTagBody method to get the response object and write the html to
> the response. Is this the correct way to do this?, meaning clean and
> reusable, or should I be looking at creating a resource and adding it with
> the application object.
>
> Thanks
> Bushby
>
> --
> View this message in context: http://www.nabble.com/Implementation-question-of-WebMarkupContainer-tf4649417.html#a13282634
> 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
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org