You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by FastGorilla <do...@gmail.com> on 2008/06/03 22:38:43 UTC

Bean properties from view?

I have knowledgde of Servlets, JSP and JSF, and reading a bit about Wicket.

Something that turns me immediately off is that you have to use something
like
add(new Label("firstName", person.getName()));
add(new Label("lastName", person.getName()));
add(new Label("address", person.getAdress()));
add(new Label("postalcode", person.getPostalcode()));
etc....
to send data to the view. Which is a lot of hardcoded duplicated property
mapping code.

Isn't it possible to just send the whole person object to the view, just
like in JSP, JSF, Facelets? Instead of manally putting all person bean using
the add-method.

-- 
View this message in context: http://www.nabble.com/Bean-properties-from-view--tp17633058p17633058.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: Bean properties from view?

Posted by Gwyn Evans <gw...@gmail.com>.
Also http://cwiki.apache.org/WICKET/more-on-models.html

On Tue, Jun 3, 2008 at 9:58 PM, Gwyn Evans <gw...@gmail.com> wrote:
> On Tue, Jun 3, 2008 at 9:38 PM, FastGorilla <do...@gmail.com> wrote:
>>
>> I have knowledgde of Servlets, JSP and JSF, and reading a bit about Wicket.
>>
>> Something that turns me immediately off is that you have to use something
>> like
>> add(new Label("firstName", person.getName()));
>> add(new Label("lastName", person.getName()));
>> add(new Label("address", person.getAdress()));
>> add(new Label("postalcode", person.getPostalcode()));
>> etc....
>> to send data to the view. Which is a lot of hardcoded duplicated property
>> mapping code.
>>
>> Isn't it possible to just send the whole person object to the view, just
>> like in JSP, JSF, Facelets? Instead of manally putting all person bean using
>> the add-method.
>
> Yes - the part that you're missing is the Modal usage in Wicket and
> particulalry, the way that components can work their way up their
> hierarchy.  See
> http://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-CompoundPropertyModels,
> for example.
>
> /Gwyn
>

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


Re: Bean properties from view?

Posted by Gwyn Evans <gw...@gmail.com>.
On Tue, Jun 3, 2008 at 9:38 PM, FastGorilla <do...@gmail.com> wrote:
>
> I have knowledgde of Servlets, JSP and JSF, and reading a bit about Wicket.
>
> Something that turns me immediately off is that you have to use something
> like
> add(new Label("firstName", person.getName()));
> add(new Label("lastName", person.getName()));
> add(new Label("address", person.getAdress()));
> add(new Label("postalcode", person.getPostalcode()));
> etc....
> to send data to the view. Which is a lot of hardcoded duplicated property
> mapping code.
>
> Isn't it possible to just send the whole person object to the view, just
> like in JSP, JSF, Facelets? Instead of manally putting all person bean using
> the add-method.

Yes - the part that you're missing is the Modal usage in Wicket and
particulalry, the way that components can work their way up their
hierarchy.  See
http://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-CompoundPropertyModels,
for example.

/Gwyn

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


Re: Bean properties from view?

Posted by FastGorilla <do...@gmail.com>.
thx for your reply Gwyn and Igor. That was the info I was looking for.



igor.vaynberg wrote:
> 
> no it is not possible. in wicket the view is dumb, it contains no
> knowledge or logic. if, for example, the person has first name and
> last name and you wanted to output a full name you would have to do
> the concatenation in java code, and the view would simply have 
> placeholder. in wicket everything is done in
> java, not spread out between controller and view.
> 
> that said, if you use a compound property model you can shorten your
> example to:
> add(new label("firstname"));
> add(new label("lastname"));
> 
> and in the view
> 
> 
> 
> -igor
> 
> On Tue, Jun 3, 2008 at 1:38 PM, FastGorilla <do...@gmail.com> wrote:
>>
>> I have knowledgde of Servlets, JSP and JSF, and reading a bit about
>> Wicket.
>>
>> Something that turns me immediately off is that you have to use something
>> like
>> add(new Label("firstName", person.getName()));
>> add(new Label("lastName", person.getName()));
>> add(new Label("address", person.getAdress()));
>> add(new Label("postalcode", person.getPostalcode()));
>> etc....
>> to send data to the view. Which is a lot of hardcoded duplicated property
>> mapping code.
>>
>> Isn't it possible to just send the whole person object to the view, just
>> like in JSP, JSF, Facelets? Instead of manally putting all person bean
>> using
>> the add-method.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Bean-properties-from-view--tp17633058p17633058.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
>>
>>
> 
> ---------------------------------------------------------------------
> 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/Bean-properties-from-view--tp17633058p17634633.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: Bean properties from view?

Posted by Igor Vaynberg <ig...@gmail.com>.
no it is not possible. in wicket the view is dumb, it contains no
knowledge or logic. if, for example, the person has first name and
last name and you wanted to output a full name you would have to do
the concatenation in java code, and the view would simply have <span
wicket:id="fullname"/> placeholder. in wicket everything is done in
java, not spread out between controller and view.

that said, if you use a compound property model you can shorten your example to:
add(new label("firstname"));
add(new label("lastname"));

and in the view

<span wicket:id="firstname"/><span wicket:id="lastname"/>

-igor

On Tue, Jun 3, 2008 at 1:38 PM, FastGorilla <do...@gmail.com> wrote:
>
> I have knowledgde of Servlets, JSP and JSF, and reading a bit about Wicket.
>
> Something that turns me immediately off is that you have to use something
> like
> add(new Label("firstName", person.getName()));
> add(new Label("lastName", person.getName()));
> add(new Label("address", person.getAdress()));
> add(new Label("postalcode", person.getPostalcode()));
> etc....
> to send data to the view. Which is a lot of hardcoded duplicated property
> mapping code.
>
> Isn't it possible to just send the whole person object to the view, just
> like in JSP, JSF, Facelets? Instead of manally putting all person bean using
> the add-method.
>
> --
> View this message in context: http://www.nabble.com/Bean-properties-from-view--tp17633058p17633058.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
>
>

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