Developing Web 2.0 applications
with JavaServerFaces
and Dreamweaver
>> Just Became Easier
Documentation
Search
  1. Introduction
  2. Getting Started
  3. Developing Web Sites
  4. Using Components
  5. Internationalization
  6. Code View Support
  7. Design View Support
  8. Keyboard Shortcuts
  9. Tag Object Toolbars
  10. JSF Server Behaviors
  11. Property Inspectors
  12. JSF Tag Reference
JSF Core Tag Library
  f:actionListener
  f:ajax
  f:attribute
  f:convertDateTime
  f:convertNumber
  f:converter
  f:event
  f:facet
  f:loadBundle
  f:metadata
  f:param
  f:phaseListener
  f:selectItem
  f:selectItems
  f:setPropertyActionListener
  f:subview
  f:validateBean
  f:validateDoubleRange
  f:validateLength
  f:validateLongRange
  f:validateRegex
  f:validateRequired
  f:validator
  f:valueChangeListener
  f:verbatim
Selected f:view
  f:viewParam
If you like this documentation, please take a look at my book:

12. JSF Core Tag Reference

Documentation > JSF > JSF Tag Reference > JSF Core Tag Library > f:view

f:view

The View tag is the container for all JavaServer Faces component tags used on a page. You can wrap the root element of the structured markup language used in your document with this tag to ensure that all child tags are part of the same view. This tag is useful for internationalization (I18N) purposes.

It provides you with several options for presenting your user with localized views of your application. By default the JSF framework will attempt to select the best view for your user based on the Accept-Language header sent to the server from the user's browser as part of the HTTP request for your page. If the locale requested by the user is not supported by your application, the JSF framework will use the default locale specified in your Faces configuration file. If you have not specified a default locale, JSF will use the default locale for the Java Virtual Machine serving your application.

If your application supports the locale requested by the user, JSF will set that locale for the view and will display the messages for that locale defined in the locale's message bundle. You can also specify the locale for which the view is to be rendered by explicitly setting the locale attribute of the view tag. This allows you to design localized versions of each page, including images and styles, for each locale you wish to support. Another option is to obtain the locale dynamically through user interaction. This information could later be stored in a cookie and/or a database to identify which locale is preferred by your user. The locale attribute accepts a value-binding expression that could resolve to the desired locale.

welcome_en.jsp (English)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">
<body>
<f:view locale="en">
	<f:loadBundle basename="com.mycompany.MessageBundle" var="bundle" />
	<h:outputText value="#{bundle.welcomeMessage}" />
</f:view>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

welcome_fr.jsp (French)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">
<body>
<f:view locale="fr">
	<f:loadBundle basename="com.mycompany.MessageBundle" var="bundle" />
	<h:outputText value="#{bundle.welcomeMessage}" />
</f:view>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

HTML Output

welcome_en.jsp (English)

Welcome to our site! 

welcome_fr.jsp (French)

Bienvenue à notre site!

Tag Attributes

afterPhase Text
 
MethodBinding pointing to a method that takes a javax. faces. event. PhaseEvent and returns void. This method will be called after every phase except for restore view.
beforePhase Text
 
MethodBinding pointing to a method that takes a javax. faces. event. PhaseEvent and returns void. This method will be called before every phase except for restore view.
contentType Text
 
Specifies the content-type of the response.
encoding Text
 
Specifies the character encoding that should be used for the response.
locale Enumerated
 
The locale attribute sets the locale to use for localizing this page. Literal values and value-binding expressions must evaluate to a java. util. Locale or to a String that can be converted to a Locale.
  • ar
  • ar_AE
  • ar_BH
  • ar_DZ
  • ar_EG
  • ar_IQ
  • ar_JO
  • ar_KW
  • ar_LB
  • ar_LY
  • ar_MA
  • ar_OM
  • ar_QA
  • ar_SA
  • ar_SD
  • ar_SY
  • ar_TN
  • ar_YE
  • be
  • be_BY
  • bg
  • bg_BG
  • ca
  • ca_ES
  • cs
  • cs_CZ
  • da
  • da_DK
  • de
  • de_AT
  • de_CH
  • de_DE
  • de_LU
  • el
  • el_GR
  • en
  • en_AU
  • en_CA
  • en_GB
  • en_IE
  • en_IN
  • en_NZ
  • en_US
  • en_ZA
  • es
  • es_AR
  • es_BO
  • es_CL
  • es_CO
  • es_CR
  • es_DO
  • es_EC
  • es_ES
  • es_GT
  • es_HN
  • es_MX
  • es_NI
  • es_PA
  • es_PE
  • es_PR
  • es_PY
  • es_SV
  • es_UY
  • es_VE
  • et
  • et_EE
  • fi
  • fi_FI
  • fr
  • fr_BE
  • fr_CA
  • fr_CH
  • fr_FR
  • fr_LU
  • hi_IN
  • hr
  • hr_HR
  • hu
  • hu_HU
  • is
  • is_IS
  • it
  • it_CH
  • it_IT
  • iw
  • iw_IL
  • ja
  • ja_JP
  • ko
  • ko_KR
  • lt
  • lt_LT
  • lv
  • lv_LV
  • mk
  • mk_MK
  • nl
  • nl_BE
  • nl_NL
  • no
  • no_NO
  • no_NO_NY
  • pl
  • pl_PL
  • pt
  • pt_BR
  • pt_PT
  • ro
  • ro_RO
  • ru
  • ru_RU
  • sk
  • sk_SK
  • sl
  • sl_SI
  • sq
  • sq_AL
  • sv
  • sv_SE
  • th
  • th_TH
  • th_TH_TH
  • tr
  • tr_TR
  • uk
  • uk_UA
  • vi
  • vi_VN
  • zh
  • zh_CN
  • zh_HK
  • zh_TW
renderKitId Text
 
Identifier for the RenderKit to use for rendering this page.