Wicket: a label is needed from a wicket: for?

In the past, I created labels for my form as follows:

<label wicket:for="name"><wicket:label><wicket:message key="name"></wicket:message></wicket:label>:</label><input wicket:id="name" type="text"/>

Should I use a tag wicket:label? I do not use wicket:labelin wickets 7, and it seems to work fine. Perhaps I do not understand the purpose of using the gate: shortcut. It seems like wicket:labelit's just extra markup. Below I do it now. It is right?:

<label wicket:for="name"><wicket:message key="name"></wicket:message>:</label><input wicket:id="name" type="text"/>

This example is associated with Wicket XHTML tags

+4
source share
1 answer

Take a look at JavaDoc AutoLabelResolverand AutoLabelTextResolver.

<label wicket:for="name"> AutoLabelResolver. HTML label HTML- ( input), HTML for . css , , , .

<wicket:label> . key ( ), , Java FormComponent, , '${label}' is required. (. LabeledWebMarkupContainer#setLabel LabeledWebMarkupContainer#getLabel).

- <wicket:label>, . , Java FormComponent .

HTML- <wicket:label> Java , Java FormComponent , Wicket Wicket . , , Wicket, , 'user_name' is required., , 'User name' is required.

+5

Source: https://habr.com/ru/post/1607355/


All Articles