JSF������

�쐬 2004/2/10
�X�V 2004/4/7

�X�V����
2004/4/24�@�R���o�[�^�lj�
2004/4/21�@�T���v���A�v���P�[�V�����lj�
2004/4/7�@HTML�^�O�T���v���y�[�W�lj�
2004/3/17�@����Final�ɂƂ��Ȃ��ύX�B�����X�V�B
2004/2/10�@�Ƃ肠��������Ă݂��B -->

������

JSF���āH

JSF���āH

JSF(JavaServer Faces)�́AJava Web�A�v���P�[�V����(�Ȃ�)���ȒP�ɂ‚��邽�߂̕W���t���[�����[�N�ł��BJSF�͈ȉ��̗��_������܂�(Spec���)�B

Ease-of-Use

���p���ȒP�ɁBWeb�A�v���P�[�V�����̃r���[�����̊J���Ƃ����̂͂����ɂ��ǂ낭�����ł��BJSF�𗘗p����Ƃǂ낭�����r���[�̊J�����A�X�C�X�C�Ƃł���悤�ɂȂ�炵���ł��B

Project Rave�AEase of Development�Ƃ������u�J�����ȒP�Ɂv���悤�Ƃ���Java���Ƃ�܂�����̈�‚ł�����Ǝv���܂��B

Standardization

�W�����BWeb�A�v���P�[�V�����̃t���[�����[�N�́A�J�����Y����ێ琫�����コ������̂Ƃ��đ������p����Ă��܂��B�������A�t���[�����[�N���g�����Ȃ����߂ɂ́A�����̎��Ԃ�K�v�Ƃ��A�t���[�����[�N�ɋ����Z�p�҂�T���̂���ςł��BJSF��JSR127�Ŏd�l���肳�ꂽ�A�W���t���[�����[�N�ł��B

�W�������邱�ƂŁA�c�[���x���_�[���J���x���c�[�����J�����₷���Ȃ�܂��BJSF��Ease-of-Use�̓c�[���ɂ��x���ƃZ�b�g�Ŏ�������܂��B

Device Independence

JSF�ł̓r���[��UI�R���|�[�l���g�̓��W�b�N�ƕ�������Ă��܂��B�u���E�U���N���C�A���g�Ƃ����AHTML�x�[�X��Web�A�v���P�[�V�����ւ̗��p���z�肳��Ă��܂����AHTML�Ɍ��肳�ꂽ���̂ł͂���܂���BUI�R���|�[�l���g�̎������񋟂����΁A���W�b�N�̕ύX�Ȃ��ɁAFlush��SWT�Ƃ��������b�`�N���C�A���g�ɈڐA�”\�ł��B

�⑫

�c�[���̃C���[�W��Microsoft��WebForm�݂����Ȃ��̂̂悤�ł�(�g�������ƂȂ�����)�BJSF���g�����J���́AJava�̃T�[�o�[�T�C�h�ɂ‚��Đ[���m��Ȃ��Ă��A�c�[�����g���ĊȒP�ɍs���邱�Ƃ�ڎw���Ă��܂��BVB�v���O���}�̂Ƃ肱�݂��ژ_�܂�Ă���悤�ł��B �Ƃ肠�����A�u���������_���CJSP�̃R�[�f�B���O�������ƃJ���^�����v���Ă������̂��Ǝv���Ă��܂��B

�Q�l

��{

Sun JSF
http://java.sun.com/j2ee/javaserverfaces/

JSR127
http://www.jcp.org/en/jsr/detail?id=127

Sun The J2EE 1.4 Tutorial
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

Sun The Java Web Services Tutorial
http://java.sun.com/webservices/docs/1.3/tutorial/doc/(J2EE 1.4 Tutrial�̕����V�����f�X)

JSF Central
http://www.jsfcentral.com/

JamesHolmes.com Java Server Faces Resources
http://www.jamesholmes.com/JavaServerFaces/

�R�~���j�e�B

Sun Developer Forum: JavaServer Faces Technology
http://forum.java.sun.com/forum.jsp?forum=427

jsf-jp(���{��ML)
http://groups.yahoo.co.jp/group/jsf-jp/

���{����

@IT JavaServer Faces�𗝉�����(2003/7/26)
http://www.atmarkit.co.jp/fjava/special/jsf01/jsf01.html

Izu@San Diego JSF
http://izu.shinzui.org/space/JSF

nemuneko.com Java Server Faces
http://nemuneko.com/jsf/

�J���x���c�[��

WebSphere Studio (5.1.1�`)
http://www-106.ibm.com/developerworks/websphere/downloads/(�]����Download)
http://www-6.ibm.com/jp/software/websphere/developer/studio/jsf/1.html(Tutorial)

Sun Studio Creator
http://wwws.sun.com/software/products/jscreator/ (2004/3/17 �܂������H)

���̑��AJSF Central��JamesHolmes.com���烊���N�����ǂ�Ƃ��낢�날��܂��B

�_�E�����[�h

������HelloWorld����Ƃ������ƂŁA���ȒP��JSF�A�v���P�[�V����������Ă݂܂����B

�‹�

�����ł͈ȉ��̊‹��Ŏ������܂����B

RI�̃_�E�����[�h

http://java.sun.com/j2ee/javaserverfaces/�̃y�[�W��Download����T���v���܂�RI(Reference Implemantaion)���_�E�����[�h�”\�ł��B�����ł͌��݂̍ŐV�ł�v1.0���_�E�����[�h���܂����B

�T���v���̎��s

�_�E�����[�h����RI��W�J���܂��Bsamples��WAR�`���̃T���v���A�v���P�[�V�����������‚�����A�f�v���C���Ď��s�”\�ł��B�����ł͗�Ƃ��āAguessNumber�A�v���P�[�V���������s���Ă݂܂��BTomcat��webapps�f�B���N�g����jsf-guessNumber.war���R�s�[���ATomcat���N�����܂��B�u���E�U�ŁAhttp://localhost:8080/jsf-guessNumber/ �ɃA�N�Z�X�����guessNumber�A�v���P�[�V�������\������܂��B

��ʁ@�T���v����guessNumber�A�v���P�[�V����

���̑��̃A�v���P�[�V���������l�̎菇�Ŏ��s�ł��܂��B���̂Ƃ��ƈႢ�Asecurity-constraint�������Ă�����̂�����Acardemo�A�v���P�[�V�����Ȃǂ́A�R���e�L�X�g���[�g��index.jsp�ł̓A�N�Z�X�s�‚ŁAindex.faces�ŃA�N�Z�X����K�v������܂��B

�͂��߂Ă�JSF

�v���W�F�N�g�̍쐬

���āA�ȒP��JSF�A�v���P�[�V�������쐬���Ă݂܂��B �����ō쐬����̂́A�P���ȓ��͉��(input.jsp)�Əo�͉��(result.jsp)���������A�v���P�[�V�����ł��B���͉�ʂł́A�e�L�X�g�t�B�[���h�ƃT�u�~�b�g�{�^����z�u���܂��B

�ȉ��́A����쐬����Web�A�v���P�[�V�����̃��\�[�X�ꗗ�ł��B

jsf1/
  WEB-INF/
    classs/
      hoge/
        MyBean.class
        Messages_ja.properties
    lib/
      commons-beanutils.jar
      commons-collections.jar
      commons-digester.jar
      commons-logging.jar
      jsf-api.jar
      jsf-impl.jar
      jstl.jar
      standard.jar
    web.xml
    faces-config.xml
index.jsp
input.jsp
result.jsp

���C�u����

�܂��Alib�ȉ��Ɋ܂߂�JAR�ł����ARI��lib�ȉ��ɂ���܂��B������RI��lib�ɂ́AJSTL��JAR(jstl.jar�Astandard.jar)���܂܂�Ă��Ȃ��̂ŁA�����ł́Ajsf-guessNumber.war�̒���WEB-INF/lib�ȉ����R�s�[���ė��p���܂���(�ʓrJSTL���_�E�����[�h���邩�A�A�v���P�[�V�����T�[�o�t���̂��̂𗘗p���Ă������ł��傤)�B

web.xml

web.xml�͈ȉ��̂悤�ɂȂ�܂��BFacesServlet��o�^���A"/faces/*"��URL�}�b�s���O���Ă���̂��킩��܂�(URL�}�b�s���O�̃p�^�[���͔C�ӂł�)�B

���X�g�@web.xml

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup> 1 </load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

</web-app>

faces-config.xml

JSF�̐ݒ�t�@�C����faces-config.xml�ł��B�f�t�H���g��WEB-INF/faces-config.xml������ł��B�܂��A�����o�^���Ă��܂���B

���X�g�@faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

</faces-config>

input.jsp

�ŏ���JSP���L�q���܂��B

���X�g�@input.jsp(�o�[�W����1)

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<body>

<f:view>
    <h2>hello</h2>
</f:view>

</body>
</html>

�ŏ��̂Q�s��JSF��taglib�錾�ŁAJSF�̃^�O���C�u������錾���Ă��܂��B<f:view>����JSF��UI�R���|�[�l���g�������Ă����܂��B�����ł͂܂�UI�R���|�[�l���g�͂������Ahello�Ƃ�����������w�肵�Ă��邾���ł��B

���s���Ă݂�

�܂��AJSF�炵�����Ƃ͉����s���Ă��܂��񂪁A�����܂ō쐬�����A�v���P�[�V�����ŁAJSF�A�v���P�[�V���������s�”\�ł��BTomcat���N�����A�u���E�U�ňȉ���URL�ɃA�N�Z�X���܂��B

http://localhost:8080/jsf1/input.jsp

���������s����ƃG���[�ɂȂ�܂��B�ȉ��̂悤�ȃG���[���o�͂���܂��B

javax.servlet.ServletException: Cannot find FacesContext

�����JSF�T�[�u���b�g���o�R�����ɁAJSF�R���|�[�l���g�𗘗p����JSP�ɒ��ڃA�N�Z�X�������߂ł��B�ς��Ɏ���URL�ŃA�N�Z�X���܂��B

http://localhost:8080/jsf1/faces/input.jsp

����ƃG���[�Ȃ����s�ł��܂����B

���X�g�@���s���

URL���͂���ł���/faces/...�Ƃ���̂���Ԃł��B�R���e�L�X�g���[�g��URL���w�肵�Ă��A�������\���ł���悤��index.jsp�Ƃ������O�̃t�@�C�����쐬���܂�(index.jsp��Tomcat�̏ꍇ�A�f�t�H���g��web.xml��welcome�t�@�C�����X�g�ł�)�B

���X�g�@index.jsp

<jsp:forward page="faces/input.jsp" />

����ŁAhttp://localhost:8080/jsf1/�@�ɃA�N�Z�X�����/index.jsp��/faces/input.jsp���\������܂��B

Backing Bean

���āA�쐬�����X�J�X�J�̃A�v���P�[�V�����ɋ@�\��lj����Ă����܂��傤�B�܂���JavaBeans���쐬���A�e�L�X�g�t�B�[���h�Ɋ֘A�Â��܂��B�܂��A�ȉ��̂悤��Java�N���X���쐬���܂��B���̃N���X��message�Ƃ����v���p�e�B�[������(getMessage�AsetMessage���\�b�h������)JavaBeans�ł��B

���X�g�@MyBean.java

package hoge;

public class MyBean {

    private String message = "hello";

    public String getMessage() {
        return message;
    }

    public void setMessage(String string) {
        message = string;
    }
}

�쐬����hoge.MyBean�N���X��faces-config.xml�ɓo�^���܂��Bmanaged-bean�v�f��Java�N���X��o�^���邱�ƂŁAJSF��UI�R���|�[�l���g�Ɗ֘A�Â��ė��p���邱�Ƃ��ł���悤�ɂȂ�܂��B

���X�g�@faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

    <managed-bean>
        <managed-bean-name>myBean</managed-bean-name>
        <managed-bean-class>hoge.MyBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

</faces-config>

����input.jsp�Ƀe�L�X�g�t�B�[���h��lj����܂��B

���X�g�@input.jsp(�o�[�W����2)

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<body>

<f:view>
    <h2>hello</h2>
    <h:form>
        <h:inputText value="#{myBean.message}"/>
    </h:form>
</f:view>

</body>
</html>

<h:form>��HTML�̃t�H�[���ɑΉ�����UI�R���|�[�l���g�ł��B <h:inputText>���e�L�X�g�t�B�[���h�ɑΉ�����UI�R���|�[�l���g�ł��BinputText��value������#{myBean.message}���w�肵�Ă��܂��B����́Afaces-config.xml�œo�^����myBean��message�v���p�e�B�[��\���Ă��܂��B

���s����Ǝ��̂悤�ȃe�L�X�g�t�B�[���h���\������܂��B�����l��hello�Ƃ��������񂪃e�L�X�g�t�B�[���h�ɕ\������Ă���̂��킩��܂��B

��ʁ@���s���

Navigation

���āA���͉�ʑJ�ڂ��s���Ă݂܂��傤�B��ʑJ�ڂ́Afaces-config.xml��navigation-rule���L�q���邱�Ƃōs���܂��B

���X�g�@faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC 
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" 
    "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

    <navigation-rule>
        <from-view-id>/input.jsp</from-view-id>
        <navigation-case>
            <from-outcome>ok</from-outcome>
            <to-view-id>/result.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

    <managed-bean>
        <managed-bean-name>myBean</managed-bean-name>
        <managed-bean-class>hoge.MyBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

</faces-config>

��̗�ł́A/input.jsp����ok�̂Ƃ���/result.jsp�֑J�ڂ���Ƃ����L�q�ɂȂ��Ă��܂��B

���ɁAinput.jsp�ɉ�ʑJ�ڗp��Submit�{�^����lj����܂��B

���X�g�@input.jsp(�o�[�W����3)

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<body>

<f:view>
    <h2>hello</h2>
    <h:form>
        <h:inputText value="#{myBean.message}"/>
        <h:commandButton action="ok" value="GOGO"/>
    </h:form>
</f:view>

</body>
</html>

�{�^����<h:commandButton<�ł��Bvalue�����ɂ�GOGO���w�肵�Ă��܂�(�\��������GOGO�ɂȂ�܂�)�B�܂�action������ok�Ƃ�����������w�肵�Ă܂��B�{�^���������ꂽ�Ƃ���"ok"�Ƃ����A�N�V���������s����(�A�N�V�������ʂ�ok���i�r�Q�[�V�����ɂ킽����)�A��ʑJ�ڂ����s����܂��B

���ɑJ�ڐ��result.jsp���쐬���܂��B

���X�g�@result.jsp

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<body>

<f:view>
    <h2>result</h2>
    <h:form>
        <h:outputText value="#{myBean.message}"/>
    </h:form>
</f:view>

</body>
</html>

�����ł�myBean��message��<h:outputText>�ŕ\�����Ă��܂��B

���s����ƁAGOGO�{�^���̂‚���input.jsp���\������A�{�^���������ƁAresult.jsp�ɑJ�ڂ���̂��킩��܂��B

��ʁ@���s���

���i�r�Q�[�V������`�́AURL�p�^�[�����w�肷�邱�Ƃ��ł��܂��B�܂��A�A�N�V�����Ȃǂ��w�肵�Ĕ͈͂����ڂ邱�Ƃ��ł��܂��B

Navigation�@-�@Baking Bean�Ƃ̘A�g

��̗Ⴞ�ƁA�P�ɁA�ÓI�ȃ����N�ƕς�肠��܂���B�{�^�����������Ƃ��ɁA�Ȃ�炩�̃r�W�l�X���W�b�N�����s���A���ʂɉ����ĉ�ʑJ�ڂ��s���悤�ɂ��Ă݂܂��傤�B��̗Ⴉ��̕ύX��MyBean.java��input.jsp�ł��B

MyBean.java�ł�doHoge()�Ƃ����������Ԃ����\�b�h��lj����܂��B

���X�g�@MyBean.java

package hoge;

public class MyBean {

    private String message = "hello";


    public String getMessage() {
        return message;
    }

    public void setMessage(String string) {
        message = string;
    }
    
    public String doHoge(){
        return "ok";
    }
}

input.jsp�ł́AcommandButton��action������#{myBean.doHoge}�ɕύX���܂��B

���X�g�@input.jsp

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<body>

<f:view>
    <h2>hello</h2>
    <h:form>
        <h:inputText value="#{myBean.message}"/>
        <h:commandButton action="#{myBean.doHoge}" value="GOGO"/>
    </h:form>
</f:view>

</body>
</html>

����ŁA�{�^���������ꂽ�Ƃ���MyBean#doHoge()���\�b�h���Ă΂�A���ʕ������"ok"����i�r�Q�[�V��������Aresult.jsp�ɉ�ʑJ�ڂ��܂��B

Event Handling

JSF�ł�UI�R���|�[�l���g�Ƀ��X�i�[���w�肵�āA�C�x���g�n���h�����O���s�����Ƃ��ł��܂��B���X�i�[�ɂ́AvalueChangeListener��actionListener������܂��B

�܂�MyBean.java�Ƀ��X�i�[���\�b�h���������܂��BvalueChangeListener��ValueChangeEvent�������ɂƂ郁�\�b�h�AactionListener��ActionEvent�������ɂƂ郁�\�b�h���쐬���܂��B�Ԃ�l��void�ł��B�Ȃ��AJSF��API�𗘗p���Ă���̂ŁAMyBean.java�̃R���p�C���ɂ�JSF�̃N���X���N���X�p�X�ɒʂ��K�v������܂��B

���X�g�@MyBean.java

package hoge;

import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;

public class MyBean {

    private String message = "hello";


    public String getMessage() {
        return message;
    }

    public void setMessage(String string) {
        message = string;
    }
    
    public String doHoge(){
        return "ok";
    }


    public void messageChanged(ValueChangeEvent event){
        System.out.println("called messageChanged");
    }

    public void hogePushed(ActionEvent e){
        System.out.println("called hogePushed");
    }

}

input.jsp�ł̓��X�i�[�����ꂼ��w�肵�܂��B

���X�g�@input.jsp

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<body>

<f:view>
    <h2>hello</h2>
    <h:form>
        <h:inputText value="#{myBean.message}"
            valueChangeListener="#{myBean.messageChanged}"/>
        <h:commandButton action="#{myBean.doHoge}" value="GOGO"
            actionListener="#{myBean.hogePushed}"/>
    </h:form>
</f:view>

</body>
</html>

���s����ƁA�{�^���������ꂽ�Ƃ���MyBean#hogePushed(...)���\�b�h���A�{�^���������ꂽ�Ƃ��ɁAmessage�̒l�ɕύX���������ꍇ��MyBean#messageChanged(...)���\�b�h���Ă΂��̂��킩��܂��B�Ȃ��A�����ł͂Q�‚̃��X�i�[�𗼕��g���Ă��܂����A�������Е������Ŏ��s�ł��܂��B

��Backing Bean�Ƀ��\�b�h��o�^�����AValueChangeListener��ActionListener�����������N���X��ʂɍ쐬������@������܂��B

Validation

�����͓��̓`�F�b�N�ł��B���̓`�F�b�N�́A�g�ݍ��݂�Vadlidator�𗘗p������@�A�����Validadator�N���X���쐬������@�Avalidate���\�b�h�𗘗p������@������܂��B�g�ݍ��݂�Validator�ɂ́ADoubleRangeValidator�ALengthValidator �ALongRangeValidator ������܂��B���̗�ł͕������`�F�b�N���s��LengthValidator�𗘗p���Ă��܂��B

���X�g�@input.jsp

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<body>

<f:view>
    <h2>hello</h2>
    <h:form>
        <h:inputText value="#{myBean.message}" >
            <f:validateLength maximum="5"/>
        </h:inputText>
        <h:commandButton action="#{myBean.doHoge}" value="GOGO"/>
        <br>
        <h:messages/>
    </h:form>
</f:view>

</body>
</html>

���X�i�[�����̃R�[�h�͊֌W�Ȃ��̂ł͂����Ă��܂�

���s���A5�������傫�ȕ���������͂��A�{�^���������Ɠ��̓G���[���\������܂��B

��ʁ@���s���

�Ȃ��A<h:messages/>�͑S���̃G���[���ꗗ����^�O�ł��B�X�̃G���[��\������ɂ�<h:message/>�^�O��for�������g���܂��Bfor�����ɂ́AUI�R���|�[�l���g��id�������w�肵�܂��B

���X�g�@�X�̃G���[�\��

<h:inputText id="mymessage" value="#{myBean.message}" >
    <f:validateLength maximum="5"/>
</h:inputText>
<h:message for="mymessage"/>

���g�ݍ��݂�Validator�ȊO(?)�ɕK�{�`�F�b�N��required="true"���w�肷��΂����܂��B
�����\�b�hValidate�A���{�ꃊ�\�[�X���͌�q(�\��)

Validation�@-�@���b�Z�[�W��`

��̗�ŕ\�����ꂽ���b�Z�[�W�́A�g�ݍ��݂̃f�t�H���g���b�Z�[�W�ł��B�f�t�H���g�̃��b�Z�[�W�t�@�C����Sun��RI�ł���΁Ajsf-impl.jar��javax.faces�ȉ��ɂ���܂��B�A�v���P�[�V�����̃��b�Z�[�W�t�@�C���́Afaces-config.xml��application�v�f�Ŏw�肵�܂��B

���X�g�@faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC 
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" 
    "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

    <application>
        <message-bundle>hoge.Messages</message-bundle>
        <locale-config>
            <default-locale>en</default-locale>
            <supported-locale>ja</supported-locale>
        </locale-config>
    </application>

    <navigation-rule>
        <from-view-id>/input.jsp</from-view-id>
        <navigation-case>
            <from-outcome>ok</from-outcome>
            <to-view-id>/result.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

    <managed-bean>
        <managed-bean-name>myBean</managed-bean-name>
        <managed-bean-class>hoge.MyBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
</faces-config>

��̗�ł�hoge.Messages���w�肵�Ă���̂ŁA�N���X�p�X���hoge/Messages.proeperties�����b�Z�[�W���\�[�X�t�@�C���ł�(���{��̃��b�Z�[�W�t�@�C����hoge/Messages_ja.proeperties)�B���̃v���p�e�B�[�t�@�C���Ƀ��b�Z�[�W���`���܂��B���{��̏ꍇ��native2ascii�������܂��傤�B

���X�g�@Messages.properties(����)

javax.faces.validator.LengthValidator.MAXIMUM=Validation Error: ''{0}''�����ȉ��œ��͂��Ă�������

���s����ƁA��`�������b�Z�[�W���\������܂��B

��ʁ@���s���

�����܂ł̂܂Ƃ�

�Ƃ肠�����A�T���v���݂悤�݂܂˂ŊȒP��JSF�A�v���P�[�V�������쐬���Ă݂܂����B�Ȃ�ƂȂ�Struts���Ⴄ��������Đ݌v�����悤�Ȉ�ۂ��󂯂܂����B�܂�JSF�̂悳���킩���ĂȂ������m��܂���BJSF�̈Ӌ`�Ƃ����̂́A�r���[�ƃ��W�b�N����������Ă��邱�ƁA����уc�[���ɂ�肱��炪���邱��(���d�g�݂��o���Ă��邱��)�ł��B�܂����׎n�߂Ȃ̂ŁA���傭���傭�X�V���Ă��������Ǝv���܂��B

�ꉞ��ō�������̂�u���Ă����܂�(�d���̂�lib�����BEclipse�v���W�F�N�g�t)�B
jsf1.zip

�Ȃ��ASun��J2EE(TM) 1.4 Tutorial(Chapter17�`)�́A�܂�JSF�܂��̂܂Ƃ܂�����񂪏��Ȃ����ŏd�󂵂܂��B
�Ȃ��ASun��The Java(TM) Web Services Tutorial(Chapter20�A21�A22)�́A�܂�JSF�܂��̂܂Ƃ܂�����񂪏��Ȃ����ŏd�󂵂܂��B����(2004/3/17)�T���v���R�[�h��Final�̑O�̎d�l�ɉ��������̂Ȃ̂ŁAHTML�^�O���኱�قȂ�܂�(Final�ł̓A���_�[�o�[��؂�łȂ��L�������P�[�X�ɕύX)�B

JSF�^�O�ɂ‚��Ă�RI�t����Tag Library Documentation�����t�@�����X�ɂȂ�܂�(tlddocs�f�B���N�g���ɂ���)�B�T���v���R�[�h�͂���܂��񂪁A���̑������w��ł��邩�Ƃ��A�ȒP�Ȑ����͋L�q����Ă��܂��B

���̃y�[�W(HTML�^�O�T���v��)


Top