`
glacier3
  • 浏览: 391045 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

JSF

阅读更多
Application的常用方法:

  Application app = facesContext.getApplication();

  public Iterator getSupportedLocales();

  public String getMessageBundle();

   String bundleName = application.getMessageBundle();
  ResourceBundle bundle =ResourceBundle.getBundle(bundleName, locale);

  public String getDefaultRenderKitId();
  public void setDefaultRenderKitId(String renderKitId);

  ---This value is configured in a JSF configuration file, and the default is “HTML_
BASIC” (which is represented by the RenderKitFactory.HTML_BASIC_RENDER_KIT
constant). You normally won’t need to reference this property, but it can be useful
in cases where you’re not sure what the default render kit is.

  public ValueBinding createValueBinding(String ref)
         throws ReferenceSyntaxException;
  public MethodBinding createMethodBinding(String ref, Class[] params)
         throws ReferenceSyntaxException;

----动态创建应用程序组件

  The Application class also has factory methods for creating several other
         types of objects, including UI components:
    public UIComponent createComponent(String componentType)
                    throws FacesException;
    public UIComponent createComponent(
            ValueBinding componentBinding,FacesContext context,String onentType)
                    throws FacesException;

----创建验证器

  public Validator createValidator(String validatorId)
             throws FacesException;
        A validator class’s identifier is made available through the VALIDATOR_ID constant.
         You may want to create a new Validator instance if you’re initializing a UI component
         in code. Validators can only be registered on components that implement
        the EditableValueHolder interface;

----创建转换器

  The following two methods can be used to create new Converter instances:
      public Converter createConverter(String converterId);
      public Converter createConverter(Class targetClass);
  You may remember from chapter 6 that converters can be registered by identifier
   or by type (Integer, Date, boolean, and so on). The first method creates a new Converter
based on its identifier, and the latter creates a new instance based on its
type. More often than not, you’ll use the first method because JSF handles the second
case for you automatically. Converter classes usually have a CONVERTER_ID constant
that equals their identifier. They can only be used with UI components that
implement the ValueHolder interface; see

  summery:

                    Whenever you need to create a new instance of these classes, you should use
    these methods rather than create the objects manually.

-------------值绑定对象

public String getExpressionString();
public Object getValue(FacesContext facesContext)
throws PropertyNotFoundException;
public void setValue(FacesContext facesContext,
Object object)
throws PropertyNotFoundException;



public boolean isReadOnly(FacesContext facesContext)
throws PropertyNotFoundException;
public Class getType(FacesContext facesContext)
throws PropertyNotFoundException;

Usually, you’ll just use getValue to retrieve the referenced object:
 User user = (User)app.createValueBinding("#{sessionScope.user}").
  getValue(facesContext);
  or setValue to set it:
  app.createValueBinding("#{sessionScope.user}").
  setValue(facesContext, user);
  PropertyNotFoundException is a runtime exception; you’re not forced to catch it.

-----方法绑定对象

public String getExpressionString();
public Object invoke(FacesContext context,
Object[] params)
throws EvaluationException,
MethodNotFoundException;
public Class getType(FacesContext context)
throws MethodNotFoundException;

public String getExpressionString();
public Object invoke(FacesContext context,
Object[] params)
throws EvaluationException,
MethodNotFoundException;
public Class getType(FacesContext context)
throws MethodNotFoundException;


        The getType method returns the class of the method’s return type.
When you’re developing applications, your use of MethodBinding will be somewhat
limited. You may, however, use it to set an action listener method, valuechange
listener method, or validator method on a specific UI component that
you are manipulating in code:

  ---动态添加

  MethodBinding mBinding =
        app.createMethodBinding("#{myBean.myActionListener}",new Class[] { ActionEvent.class } );
  myUICommand.setActionListener(mBinding);

----------context

     Context is a popular term in modern APIs. It’s all over the place in Java—EJBContext,
ServletContext, NamingContext, and so on. If you go to Dictionary.com and
look up context, you’ll find this definition: “The circumstances in which an event
occurs; a setting.” In the world of JavaServer Faces, that event is something the
user does with the UI like clicking on a hyperlink or expanding a node in a tree
control. Once event processing has begun, you have access to the application’s
setting, or state. This state is encapsulated in the FacesContext class, from which
you can access messages and the external context (which is provided by the servlet
or portlet container). This state is fleeting; it exists only while events are being
processed.




分享到:
评论

相关推荐

    JSF上传 JSF大文件上传 JSF上传代码 JSF上传源代码

    JSF(JavaServer Faces)是Java平台上用于构建用户界面的Web框架,尤其在处理表单和数据交互方面表现强大。本项目聚焦于JSF的文件上传功能,特别是针对大文件的上传,允许用户上传最大可达1.99GB的文件。在实际应用...

    JSF Java Server Faces (JSF)框架

    JSF是一种用于构建Java Web 应用程序的标准框架(是Java Community Process 规定的JSR-127标准)。JSF(Java Server Faces)技术为开发基于网络用户界面的Java开发者提供了标准的编程接口API以及标签库。就像Struts框架...

    JSF文件下载实现

    **JSF 文件下载实现** 在JavaServer Faces (JSF)框架中,实现文件下载功能是一项常见的需求。在本文中,我们将深入探讨如何使用JSF来实现在Web应用程序中下载文件的功能。主要涉及的关键知识点包括: 1. **JSF上...

    jsf-api.jar和jsf-impl.jar

    **JSF(JavaServer Faces)** 是一个Java平台上的用户界面框架,用于构建Web应用程序。它提供了一种组件化和事件驱动的方式来创建交互式的Web界面。JSF API 和 JSF Impl 是JSF框架的核心组成部分。 **jsf-api.jar**...

    开发JSF所需要的jar包

    JavaServer Faces(JSF)是Java平台上的一种用于构建Web应用程序的MVC(Model-View-Controller)框架。它提供了一种组件化的方式来构建用户界面,简化了前后端交互的复杂性。在JSF中,开发者可以使用声明式编程模型...

    jsf1.2 jar包下载

    JavaServer Faces(JSF)是Java平台上的一种用于构建用户界面的服务器端Web应用程序框架,它遵循Model-View-Controller(MVC)设计模式。JSF 1.2是该框架的一个较早版本,发布于2006年,提供了一系列增强功能和改进...

    IDEA创建JSF项目所需jar包.zip

    在JavaServer Faces (JSF) 开发环境中,IntelliJ IDEA (IDEA) 是一个流行的集成开发环境。这个“IDEA创建JSF项目所需jar包.zip”文件包含了两个关键的库文件,它们对于在IDEA中成功搭建JSF项目至关重要。下面我们将...

    JSF开发必备JAR

    ================================= JSF开发必备JAR ================================= <br>《JSF入门简单中文版》开篇提到JSF开发需要的jar,' 但是按其中提供的方法: <br>jstl.jar 与 ...

    JSF中文教程jsf

    **JSF(JavaServer Faces)** 是一个Java平台上的用户界面框架,用于构建Web应用程序。它简化了开发人员创建交互式、数据驱动的Web界面的过程。JSF提供了一个组件模型,允许开发者通过拖放组件的方式来构建用户界面...

    JSF与hibernate整合的登陆

    **JSF(JavaServer Faces)** 是Java平台上的一种用于构建用户界面的Web应用程序框架,它简化了开发人员创建和管理动态Web用户界面的过程。JSF提供了组件库、事件处理机制和生命周期管理,允许开发者通过声明式的...

    jsf-api.jar

    JSF(JavaServer Faces)是Java平台上的一种用于构建用户界面的MVC(Model-View-Controller)框架。它简化了Web应用开发,提供了一种声明式的方式来创建动态、交互式的Web界面。`jsf-api.jar` 文件是JSF API的核心库...

    jsf-api-2.0.3.jar.zip_jsf api_jsf jar包_jsf-api-2.0.3.jar_jsf-api

    JSF(JavaServer Faces)是Java平台上的一种用于构建用户界面的MVC(Model-View-Controller)框架。它提供了一种声明式的方式来创建Web应用程序,允许开发者通过组件和事件处理来构建用户界面,而无需深入HTML和...

    jsf第一个例子 jsf架包 jsf实例

    **JSF(JavaServer Faces)** 是一个Java平台上的用户界面框架,用于构建Web应用程序。它为开发人员提供了一种模型-视图-控制器(MVC)架构,简化了前端和后端之间的交互。JSF提供了组件库,使得创建动态、交互式的...

    用jsf做的登录注册的组件

    JSF(JavaServer Faces)是一种用于构建Web应用程序的Java技术,它提供了一种声明式的方式来创建用户界面,并处理用户交互。在这个"用jsf做的登录注册的组件"中,我们可能会涉及以下几个关键知识点: 1. **JSF架构*...

    JSF的工作方式 JSF架构 JSF模型 JSF事件类型

    JavaServer Faces (JSF) 是一个用于构建用户界面的Java Web框架,它简化了创建和维护Web应用程序的复杂性。JSF的核心理念是提供一种组件化的编程模型,将UI元素与业务逻辑分离,使得开发者可以专注于应用的逻辑部分...

    JSF包,jsf包,JSF包,jsf包

    **JSF(JavaServer Faces)** 是一种Java平台上的Web应用程序开发框架,它提供了一种组件化和事件驱动的方式来创建用户界面。JSF的核心概念包括组件、事件、渲染器和生命周期,这些元素共同构建了一个强大的MVC...

    JSF入门+JSF web实战+JSF2

    JavaServer Faces(JSF)是Java平台上的一种用于构建Web应用程序的MVC(Model-View-Controller)框架。它提供了一种声明式的方式来构建用户界面,简化了开发过程,并且与Java EE平台无缝集成。本系列资料包括《JSF...

    jsf分页 jsf分页 jsf分页

    在JavaServer Faces (JSF)框架中,分页是一种常用的技术,用于处理大量数据时提供更好的用户体验。当数据集过大,一次性加载所有记录到页面上会导致性能下降且用户界面响应变慢。通过分页,我们可以将数据分成多个...

    javaee.jar,jsf-api.jar,jsf-impl.jar,jstl-1.2.jar

    3. **jsf-impl.jar**:与jsf-api.jar相对应,这个文件包含了JSF的实现代码。在实际开发中,开发者通常只需要引用api.jar进行编程,而impl.jar则在运行时提供具体的实现细节,执行用户界面的渲染和事件处理等功能。 ...

    图书管理系统-BookM_JSF_Hibernate_Spring

    《图书管理系统-BookM_JSF_Hibernate_Spring》是一个基于Java技术栈的Web应用程序,它融合了多个核心技术,包括JavaServer Faces(JSF)、Hibernate、Spring框架以及ajax4jsf库,旨在提供一个高效、易用的图书管理...

Global site tag (gtag.js) - Google Analytics