﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-呆羊在晒太阳-随笔分类-jsf</title><link>http://www.blogjava.net/mocci/category/3873.html</link><description>-------杂七杂八-------&lt;br&gt;&lt;br&gt;&lt;br&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-4344232086756417";
google_ad_width = 500;
google_ad_height = 15;
google_ad_format = "728x15_0ads_al";
google_ad_channel ="";
google_color_border = "CAF99B";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 10:54:05 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 10:54:05 GMT</pubDate><ttl>60</ttl><item><title>jstl 学习地</title><link>http://www.blogjava.net/mocci/archive/2006/02/09/30016.html</link><dc:creator>小叉</dc:creator><author>小叉</author><pubDate>Thu, 09 Feb 2006 04:41:00 GMT</pubDate><guid>http://www.blogjava.net/mocci/archive/2006/02/09/30016.html</guid><wfw:comment>http://www.blogjava.net/mocci/comments/30016.html</wfw:comment><comments>http://www.blogjava.net/mocci/archive/2006/02/09/30016.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/mocci/comments/commentRss/30016.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mocci/services/trackbacks/30016.html</trackback:ping><description><![CDATA[<DIV><SPAN class=astitle><A href="http://www-900.ibm.com/developerWorks/cn/java/j-jsp05273/" target=_blank>JSP 最佳实践： 使用JSTL来更新JSP页面</A></SPAN> </DIV>
<DIV><SPAN class=astitle><A href="http://www-900.ibm.com/developerWorks/cn/java/j-jsp04293/" target=_blank>JSP 最佳实践：用 jsp:include 控制动态内容 </A></SPAN></DIV>
<DIV><SPAN class=astitle><SPAN class=astitle><A href="http://www-900.ibm.com/developerWorks/cn/java/j-jstl0211/" target=_blank>JSTL 入门：表达式语言</A></SPAN></SPAN></DIV><img src ="http://www.blogjava.net/mocci/aggbug/30016.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mocci/" target="_blank">小叉</a> 2006-02-09 12:41 <a href="http://www.blogjava.net/mocci/archive/2006/02/09/30016.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsf的一个简单的例子</title><link>http://www.blogjava.net/mocci/archive/2005/10/15/15597.html</link><dc:creator>小叉</dc:creator><author>小叉</author><pubDate>Sat, 15 Oct 2005 13:14:00 GMT</pubDate><guid>http://www.blogjava.net/mocci/archive/2005/10/15/15597.html</guid><wfw:comment>http://www.blogjava.net/mocci/comments/15597.html</wfw:comment><comments>http://www.blogjava.net/mocci/archive/2005/10/15/15597.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/mocci/comments/commentRss/15597.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mocci/services/trackbacks/15597.html</trackback:ping><description><![CDATA[<P>You usually set up your web application as you would do with any other JSF web application. The following sample configuration files show you how to enable the above mentioned features. 
<P>
<P>The web.xml configuration: </P>
<DIV class=file>WEB-INF/web.xml</DIV>
<DIV class=code><PRE>&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd"&gt;

&lt;web-app&gt;
    <SPAN class=comment>&lt;!--
        The filter used to publish <A title="class or interface in org.springframework.web.context.support" href="http://www.springframework.org/docs/api/org/springframework/web/context/support/RequestHandledEvent.html"><CODE>RequestHandledEvent</CODE></A> to Spring.
        Should be mapped to the same url pattern than the FacesServlet.
    --&gt;</SPAN>
    &lt;filter&gt;
        &lt;filter-name&gt;RequestHandled&lt;/filter-name&gt;
        &lt;filter-class&gt;de.mindmatters.faces.spring.RequestHandledFilter&lt;/filter-class&gt;
    &lt;/filter&gt;
    &lt;filter-mapping&gt;
        &lt;filter-name&gt;RequestHandled&lt;/filter-name&gt;
        &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
    
    <SPAN class=comment>&lt;!--
        The listener used to load the parent application context (the spring beans).
    --&gt;</SPAN>
    &lt;listener&gt;
        &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;

    <SPAN class=comment>&lt;!--
        The declaration of your <A title="class or interface in javax.faces.webapp" href="http://java.sun.com/j2ee/javaserverfaces/1.0/docs/api/javax/faces/webapp/FacesServlet.html"><CODE>FacesServlet</CODE></A>.
        Map it to whatever url pattern you like.
    --&gt;</SPAN>
    &lt;servlet&gt;
        &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
&lt;/web-app&gt;
</PRE></DIV>
<P>A web.xml configuration with net.sourceforge.myfaces JSF-implementation 1.0.2 (because an internal spring-based VariableResolver is used a few features which are not supported by MyFaces yet, e.g. list-entries, map-entries..., are enabled): </P>
<DIV class=file>WEB-INF/web.xml</DIV>
<DIV class=code><PRE>&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd"&gt;

&lt;web-app&gt;
    <SPAN class=comment>&lt;!--
        The filter used to publish <A title="class or interface in org.springframework.web.context.support" href="http://www.springframework.org/docs/api/org/springframework/web/context/support/RequestHandledEvent.html"><CODE>RequestHandledEvent</CODE></A> to Spring.
        Should be mapped to the same url pattern than the FacesServlet.
    --&gt;</SPAN>
    &lt;filter&gt;
        &lt;filter-name&gt;RequestHandled&lt;/filter-name&gt;
        &lt;filter-class&gt;org.springframework.web.jsf.RequestHandledFilter&lt;/filter-class&gt;
    &lt;/filter&gt;
    &lt;filter-mapping&gt;
        &lt;filter-name&gt;RequestHandled&lt;/filter-name&gt;
        &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
    
    <SPAN class=comment>&lt;!--
        The listener used to load the parent application context (the spring beans).
    --&gt;</SPAN>
    &lt;listener&gt;
        &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;

    <SPAN class=comment>&lt;!--
        The declaration of MyFaces startup-listener.
    --&gt;</SPAN>
    &lt;listener&gt;
        &lt;listener-class&gt;net.sourceforge.myfaces.webapp.StartupServletContextListener&lt;/listener-class&gt;
    &lt;/listener&gt;

    <SPAN class=comment>&lt;!--
        The declaration of your <A title="class or interface in javax.faces.webapp" href="http://java.sun.com/j2ee/javaserverfaces/1.0/docs/api/javax/faces/webapp/FacesServlet.html"><CODE>FacesServlet</CODE></A>.
        Map it to whatever url pattern you like.
    --&gt;</SPAN>
    &lt;servlet&gt;
        &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
&lt;/web-app&gt;
</PRE></DIV><!-- ************************************************** -->
<H3>Example</H3>
<P>In this example, we just use two beans: 
<UL>
<LI><CODE>example.NameBean</CODE><BR>with one property: 
<UL>
<LI><CODE>name</CODE> </LI></UL>and two methods that receive JSF events: 
<UL>
<LI><CODE>public void action(ActionEvent event)</CODE> 
<LI><CODE>public void valueChanged(ValueChangeEvent event)</CODE> </LI></UL>
<LI><CODE>example.ReferencingBean</CODE><BR>with one property: 
<UL>
<LI><CODE>referencedBean</CODE> </LI></UL></LI></UL>
<P></P>
<DIV class=file>WEB-INF/faces-config.xml (partial)</DIV>
<DIV class=code><PRE><SPAN class=comment>&lt;!-- a purely JSF managed bean --&gt;</SPAN>
&lt;managed-bean&gt;
    &lt;managed-bean-name&gt;jsfBean&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;example.NameBean&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
    &lt;managed-property&gt;
        &lt;property-name&gt;name&lt;/property-name&gt;
    &lt;/managed-property&gt;
&lt;/managed-bean&gt;

<SPAN class=comment>&lt;!-- a <CODE>de.mindmatters.faces.spring.SpringBeanFactory</CODE> used to define the scope of a Spring managed bean --&gt;</SPAN>
&lt;managed-bean&gt;
    &lt;managed-bean-name&gt;scopedAccessSpringBean&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;de.mindmatters.faces.spring.SpringBeanFactory&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
&lt;/managed-bean&gt;

<SPAN class=comment>&lt;!-- a purely JSF managed bean that holds a reference to a Spring managed bean --&gt;</SPAN>
&lt;managed-bean&gt;
    &lt;managed-bean-name&gt;referencingBean&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;example.ReferencingBean&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
    &lt;managed-property&gt;
        &lt;property-name&gt;referencedBean&lt;/property-name&gt;
        &lt;value&gt;#{managedPropertyAccessSpringBean}&lt;/value&gt;
    &lt;/managed-property&gt;
&lt;/managed-bean&gt;
</PRE></DIV>
<P>
<DIV class=file>WEB-INF/applicationContext.xml (partial)</DIV>
<DIV class=code><PRE><SPAN class=comment>&lt;!-- a purely Spring managed bean --&gt;</SPAN>
&lt;bean id="directAccessSpringBean" class="example.NameBean"/&gt;

<SPAN class=comment>&lt;!-- a Spring managed bean supplied with a scope within JSF --&gt;</SPAN>
&lt;bean id="scopedAccessSpringBean" class="example.NameBean" singleton="false"/&gt;

<SPAN class=comment>&lt;!--
    a purely Spring managed bean being referenced by a JSF managed bean
    (but which of course can be accessed directly as well)
-&gt;</SPAN>
&lt;bean id="managedPropertyAccessSpringBean" class="example.NameBean" singleton="false"/&gt;
</PRE></DIV>
<P>
<DIV class=file>test.jsp</DIV>
<DIV class=code><PRE>&lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %&gt;
&lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %&gt;
&lt;html&gt;
    &lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;
    &lt;body bgcolor="white"&gt;
        &lt;f:view&gt;
            &lt;h:messages/&gt;
            &lt;h:form&gt;
                purely JSF managed bean:
                &lt;h:inputText value="#{jsfBean.name}"
                             valueChangeListener="#{jsfBean.valueChanged}"/&gt;
                &lt;h:commandButton value="action"
                                 actionListener="#{jsfBean.action}"/&gt;
                &lt;br/&gt;
                purely Spring managed bean:
                &lt;h:inputText value="#{directAccessSpringBean.name}"
                             valueChangeListener="#{directAccessSpringBean.valueChanged}"/&gt;
                &lt;h:commandButton value="action"
                                 actionListener="#{directAccessSpringBean.action}"/&gt;
                &lt;br/&gt;
                scoped Spring managed bean:
                &lt;h:inputText value="#{scopedAccessSpringBean.name}"
                             valueChangeListener="#{scopedAccessSpringBean.valueChanged}"/&gt;
                &lt;h:commandButton value="action"
                                 actionListener="#{scopedAccessSpringBeanaction}"/&gt;
                &lt;br/&gt;
                referenced Spring managed bean:
                &lt;h:inputText value="#{referencingBean.referencedBean.name}"
                             valueChangeListener="#{referencingBean.referencedBean.valueChanged}"/&gt;
                &lt;h:commandButton value="action"
                                 actionListener="#{referencingBean.referencedBean.action}"/&gt;
                &lt;br/&gt;
                &lt;h:commandButton id="submit" action="save" value="save"/&gt;
            &lt;/h:form&gt;
        &lt;/f:view&gt;
    &lt;/body&gt;
&lt;/html&gt;
</PRE></DIV><img src ="http://www.blogjava.net/mocci/aggbug/15597.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mocci/" target="_blank">小叉</a> 2005-10-15 21:14 <a href="http://www.blogjava.net/mocci/archive/2005/10/15/15597.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsf-spring</title><link>http://www.blogjava.net/mocci/archive/2005/10/15/15591.html</link><dc:creator>小叉</dc:creator><author>小叉</author><pubDate>Sat, 15 Oct 2005 11:39:00 GMT</pubDate><guid>http://www.blogjava.net/mocci/archive/2005/10/15/15591.html</guid><wfw:comment>http://www.blogjava.net/mocci/comments/15591.html</wfw:comment><comments>http://www.blogjava.net/mocci/archive/2005/10/15/15591.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/mocci/comments/commentRss/15591.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/mocci/services/trackbacks/15591.html</trackback:ping><description><![CDATA[<A href="http://jsf-spring.sourceforge.net/">http://jsf-spring.sourceforge.net/</A><img src ="http://www.blogjava.net/mocci/aggbug/15591.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/mocci/" target="_blank">小叉</a> 2005-10-15 19:39 <a href="http://www.blogjava.net/mocci/archive/2005/10/15/15591.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>