Java Reference
In-Depth Information
As can be seen in the above screenshot, in this example, we modified the
id
attribute
from its default value of
textField1
to
firstNameField.
. We also modified the
columns
attribute to
10
from its default value of
20
. The
columns
attribute dictates how many
characters are visible in the text field without scrolling. Additionally, we modified
the
label
attribute to
First Name
. This attribute adds a label to our text field. The
style
attribute is meant to add CSS styles to our component; NetBeans automatically
sets this value to a style that will place the text field component in the correct location
on the page. Lastly, we made our text field required by checking the
required
check box.
As we modify these attributes, the design window changes to reflect our changes.
Notice that the label was automatically added to our page, as well as a red asterisk
indicating that the field is required. The size of the text field was also modified to
reflect the value we gave to its
columns
attribute.
Visual JSF applications are standard JSF applications, therefore while we are
graphically manipulating the page, a JSP is being created behind the scenes. We can
view the source of the JSP by clicking on the
JSP
tab.