JSF event handling - JSF/struts/tiles

Has somebody had any luck integrating these technologies
and having events for JSF work?
Gisella

I just came back from the Thanksgiving holiday.
I followed the IBM tutorial and got the stuff to
work. But I have JSF events that work fine when
they were used in a framework with JSF only. Once I put
Struts and Tiles, the events were not caught all the time;
only some times. I traced the code and maybe
because of Tiles, the Render Response Phase from JSF did not take place.
"Ordinary Guy", when you said that you had an action listener hooked to a command button, I assume you refer
to a JSF action listener. Right?
Gisella

Similar Messages

  • Event handling with JSF

    Hi Everybody,
    I have a question about event handling and I am just wondering if I can do the following with JSF.
    I have two HTML dropdown lists A and B. When ever a value changes in list A, based on the selected value, list B has to be populated. Is it possible to do with JSF? Can you guys give me pointers where some code samples may be available?
    Cheers!
    Krish

    Take a look at the JSF Value-Changed Listener sections

  • How to Implement Strut Tiles  Framework in JSF

    Hi
    I am new to JSF tried to implent struts tiles in jsf 1.2 but i am facing some problm.
    is any one have ideas about how to implementing struts tiles framework in jsf??....
    Cheers
    Sekar M

    Hope the below URLs should answer your question
    [http://www.jroller.com/HazemBlog/entry/how_to_use_struts_tiles]
    [http://www.ibm.com/developerworks/library/j-integrate/]
    [http://www.laliluna.de/blog/2007/02/28/struts_tiles_jsf_myfaces_migration_or_integration.html]

  • About jsf and tiles

    Good days , the following exception is happening:
    javax.faces.FacesException
    at de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:53)
    at de.mindmatters.faces.lifecycle.AbstractPhase.execute(AbstractPhase.java:37)
    at de.mindmatters.faces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:166)
    at de.mindmatters.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:226)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:406)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at org.mortbay.jetty.Server.handle(Server.java:313)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
    Caused by: java.lang.NullPointerException
    at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:168)
    at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
    at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
    at de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:45)
    ... 21 more
    my web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>true</param-value>
    <description>
    Set this flag to true if you want the JSF
    Reference Implementation to verify that all of the application
    objects you have configured (components, converters,
    renderers, and validators) can be successfully created.
    Default value is false.
    Poner a false cuando se ponga en produccion.
    </description>
    </context-param>
    <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
    <description>
    Set this flag to true if you want the JSF
    Reference Implementation to validate the XML in your
    faces-config.xml resources against the DTD. Default
    value is false.
    Poner a false cuando se ponga en produccion.
    </description>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    <description>
    Indica donde queremos guardar el estado de la aplicacion.
    Poner a server cuando se ponga en produccion. antes probarlo!
    </description>
    </context-param>
    <context-param>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
    <description>
    Este parametro le dice a MyFaces si se va a permitir renderizar javascript.
    Default: "true"
    </description>
    </context-param>
    <context-param>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
    <description>
    si es verdadero, el renderizado html estara formateado, permitiendo que se pueda leer
    bien. En la fase de desarrollo, estara a true, cuando este en produccion, estara a false.
    </description>
    </context-param>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>
    index.jsp
    </welcome-file>
    </welcome-file-list>
    <!-- listener de spring-->
    <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- Tiles configuration
    definition files and a listener need to be defined.
    the listener will initialize JspTilesViewHandlerImpl with tiles definitions.
    -->
    <servlet>
    <servlet-name>TilesServet</servlet-name>
    <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
    <init-param>
    <param-name>definitions-config</param-name>
    <param-value>/WEB-INF/tiles-defs.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <filter>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    </filter>
    </web-app>
    tiles-defs.xml
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE tiles-definitions PUBLIC
    "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
    <tiles-definitions>
    <definition name="Base" path="/paginas/plantillaBasica.jsp">
    <put name="titulo" value="Base" type="string"/>
    <put name="cabecera" value="/cabecera.jsp" type="page"/>
    <put name="cuerpo" value="base" type="page"/>
    <put name="pie" value="base" type="page"/>
    </definition>
    <definition name="/busquedaDosCajas.tiles" extends="Base">
    <put name="titulo" value="Busqueda con dos cajas" type="string"/>
    <put name="cuerpo" value="/paginas/cuerpoDosCajas.jsp" type="page"/>
    </definition>
    </tiles-definitions>
    faces-config.xml
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <!-- =========== FULL CONFIGURATION FILE ================================== -->
    <faces-config>
    <application>
    <view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>
    </application>
    <!-- El mantenimiento del bean proxy se delega al contenedor de spring-->
    <application>
    <variable-resolver>
    org.springframework.web.jsf.DelegatingVariableResolver
    </variable-resolver>
    </application>
    <!-- el unico idioma permitido es el espa�ol.-->
    <application>
    <locale-config>
    <default-locale>es</default-locale>
    </locale-config>
    </application>
    <!--
    - navigation rules
    -->
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>succesNoJS</from-outcome>
    <to-view-id>/paginas/listado.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>error</from-outcome>
    <to-view-id>error.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    index.jsp
    <%@ page session="false"%>
    <%
    response.sendRedirect("busquedaDosCajas.jsf");
    %>
    anybody could help me? i dont know whats happening
    regards a lot

    first make sure you are using Tiles stand-alone (in Struts Sandbox)
    add the follwoing servlet to your web.xml
    <servlet>
    <servlet-name>Tiles Servlet</servlet-name>
    <servlet-class>org.apache.tiles.servlet.TilesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    add the following context-param to your web.xml
    <context-param>
    <param-name>tiles-definitions</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>
    add the following to your faces-config.xml
    <view-handler>org.apache.shale.tiles.TilesViewHandler</view-handler>
    add the following dependency to your pom.xml
    <dependency>
    <groupId>org.apache.shale</groupId>
    <artifactId>shale-tiles</artifactId>
    <version>1.0.3</version>
    </dependency>
    that should be it.
    Khaled

  • Jsf and tiles

    hi all.
    i'm developing an application using jsf and tiles.
    i've some problem in the general layout page.
    how can I refer to images and files,if I don't know where the page will be used?
    with struts i've used <html:rewrite page=" ... " /> but it doesn't work with jsf.
    I only use the TilesServlet.
    any suggestion?
    i've also try to define the url like "/css/mycss.css" but in local dosn't work.
    thank a lot for any reply!

    hi all.
    i'm developing an application using jsf and tiles.
    i've some problem in the general layout page.
    how can I refer to images and files,if I don't know where the page will be used?
    with struts i've used <html:rewrite page=" ... " /> but it doesn't work with jsf.
    I only use the TilesServlet.
    any suggestion?
    i've also try to define the url like "/css/mycss.css" but in local dosn't work.
    thank a lot for any reply!

  • J2EE MVC模式JSF与Struts的异同

    J2EE MVC模式JSF与Struts的异同
    Struts和JSF/Tapestry都属于表现层框架,这两种分属不同性质的框架,后者是一种事件驱动型的组件模型,而Struts只是单纯的MVC模式框架,老外总是急吼吼说事件驱动型就比MVC模式框架好,何以见得,我们下面进行详细分析比较一下到底是怎么回事?
      首先事件是指从客户端页面(浏览器)由用户操作触发的事件,Struts使用Action来接受浏览器表单提交的事件,这里使用了Command模式,每个继承Action的子类都必须实现一个方法execute。
      在struts中,实际是一个表单Form对应一个Action类(或DispatchAction),换一句话说:在Struts中实际是一个表单只能对应一个事件,struts这种事件方式称为application event,application event和component event相比是一种粗粒度的事件。
      struts重要的表单对象ActionForm是一种对象,它代表了一种应用,这个对象中至少包含几个字段,这些字段是Jsp页面表单中的input字段,因为一个表单对应一个事件,所以,当我们需要将事件粒度细化到表单中这些字段时,也就是说,一个字段对应一个事件时,单纯使用Struts就不太可能,当然通过结合JavaScript也是可以转弯实现的。
      而这种情况使用JSF就可以方便实现,
    <h:inputText id="userId" value="#{login.userId}">
      <f:valueChangeListener type="logindemo.UserLoginChanged" />
    </h:inputText>
      #{login.userId}表示从名为login的JavaBean的getUserId获得的结果,这个功能使用struts也可以实现,name="login" property="userId"
      关键是第二行,这里表示如果userId的值改变并且确定提交后,将触发调用类UserLoginChanged的processValueChanged(...)方法。
      JSF可以为组件提供两种事件:Value Changed和 Action. 前者我们已经在上节见识过用处,后者就相当于struts中表单提交Action机制,它的JSF写法如下:
    <h:commandButton id="login" commandName="login">
      <f:actionListener type=”logindemo.LoginActionListener” />
    </h:commandButton>
      从代码可以看出,这两种事件是通过Listerner这样观察者模式贴在具体组件字段上的,而Struts此类事件是原始的一种表单提交Submit触发机制。如果说前者比较语言化(编程语言习惯做法类似Swing编程);后者是属于WEB化,因为它是来自Html表单,如果你起步是从Perl/PHP开始,反而容易接受Struts这种风格。
      基本配置
      Struts和JSF都是一种框架,JSF必须需要两种包JSF核心包、JSTL包(标签库),此外,JSF还将使用到Apache项目的一些commons包,这些Apache包只要部署在你的服务器中既可。
      JSF包下载地址:http://java.sun.com/j2ee/javaserverfaces/download.html选择其中Reference Implementation。
      JSTL包下载在http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
      所以,从JSF的驱动包组成看,其开源基因也占据很大的比重,JSF是一个SUN伙伴们工业标准和开源之间的一个混血儿。
      上述两个地址下载的jar合并在一起就是JSF所需要的全部驱动包了。与Struts的驱动包一样,这些驱动包必须位于Web项目的WEB-INF/lib,和Struts一样的是也必须在web.xml中有如下配置:
    <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>
      这里和Struts的web.xml配置何其相似,简直一模一样。
      正如Struts的struts-config.xml一样,JSF也有类似的faces-config.xml配置文件:
    <faces-config>
      <navigation-rule>
        <from-view-id>/index.jsp</from-view-id>
        <navigation-case>
          <from-outcome>login</from-outcome>
          <to-view-id>/welcome.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>
      <managed-bean>
        <managed-bean-name>user</managed-bean-name>
        <managed-bean-class>com.corejsf.UserBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    </faces-config>
      在Struts-config.xml中有ActionForm Action以及Jsp之间的流程关系,在faces-config.xml中,也有这样的流程,我们具体解释一下Navigation:
      在index.jsp中有一个事件:
    <h:commandButton label="Login" action="login" />
      action的值必须匹配form-outcome值,上述Navigation配置表示:如果在index.jsp中有一个login事件,那么事件触发后下一个页面将是welcome.jsp
      JSF有一个独立的事件发生和页面导航的流程安排,这个思路比struts要非常清晰。
      managed-bean类似Struts的ActionForm,正如可以在struts-config.xml中定义ActionForm的scope一样,这里也定义了managed-bean的scope为session。
      但是如果你只以为JSF的managed-bean就这点功能就错了,JSF融入了新的Ioc模式/依赖性注射等技术。
    Ioc模式
      对于Userbean这样一个managed-bean,其代码如下:
    public class UserBean {
      private String name;
      private String password;
      // PROPERTY: name
      public String getName() { return name; }
      public void setName(String newValue) { name = newValue; }
      // PROPERTY: password
      public String getPassword() { return password; }
      public void setPassword(String newValue) { password = newValue; }
    <managed-bean>
      <managed-bean-name>user</managed-bean-name>
      <managed-bean-class>com.corejsf.UserBean</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
        <property-name>name</property-name>
        <value>me</value>
      </managed-property>
      <managed-property>
        <property-name>password</property-name>
        <value>secret</value>
      </managed-property>
    </managed-bean>
      faces-config.xml这段配置其实是将"me"赋值给name,将secret赋值给password,这是采取Ioc模式中的Setter注射方式。
      Backing Beans
      对于一个web form,我们可以使用一个bean包含其涉及的所有组件,这个bean就称为Backing Bean, Backing Bean的优点是:一个单个类可以封装相关一系列功能的数据和逻辑。
      说白了,就是一个Javabean里包含其他Javabean,互相调用,属于Facade模式或Adapter模式。
      对于一个Backing Beans来说,其中包含了几个managed-bean,managed-bean一定是有scope的,那么这其中的几个managed-beans如何配置它们的scope呢?
    <managed-bean>
      <managed-property>
        <property-name>visit</property-name>
        <value>#{sessionScope.visit}</value>
      </managed-property>
      这里配置了一个Backing Beans中有一个setVisit方法,将这个visit赋值为session中的visit,这样以后在程序中我们只管访问visit对象,从中获取我们希望的数据(如用户登陆注册信息),而visit是保存在session还是application或request只需要配置既可。
      UI界面
      JSF和Struts一样,除了JavaBeans类之外,还有页面表现元素,都是是使用标签完成的,Struts也提供了struts-faces.tld标签库向JSF过渡。
      使用Struts标签库编程复杂页面时,一个最大问题是会大量使用logic标签,这个logic如同if语句,一旦写起来,搞的JSP页面象俄罗斯方块一样,但是使用JSF标签就简洁优美:
    <jia:navigatorItem name="inbox" label="InBox"
      icon="/images/inbox.gif"
      action="inbox"
      disabled="#{!authenticationBean.inboxAuthorized}"/>
      如果authenticationBean中inboxAuthorized返回是假,那么这一行标签就不用显示,多干净利索!
      先写到这里,我会继续对JSF深入比较下去,如果研究过Jdon框架的人,可能会发现,Jdon框架的jdonframework.xml中service配置和managed-bean一样都使用了依赖注射,看来对Javabean的依赖注射已经迅速地成为一种新技术象征,如果你还不了解Ioc模式,赶紧补课。

    JSF在很大程度上类似Struts,而不是类似Tapestry,可以说是一种Struts 2.0,都是采取标签库+组件的形式,只是JSF的组件概念没有象Struts那样必须继承ActionForm的限制;JSF在事件粒度上要细腻,不象Struts那样,一个表单一个事件,JSF可以细化到表单中的每个字段上。
      JSF只有在组件和事件机制这个概念上类似Tapestry,但是不似Tapestry那样是一个完全组件的框架,所以,如果你做一个对页面要求灵活度相当高的系统,选用Tapestry是第一考虑。
      Struts/JSF则适合在一般的数据页面录入的系统中,对于Struts和JSF的选用,我目前个人观点是:如果你是一个新的系统,可以直接从JSF开始;如果你已经使用Struts,不必转换,如果需要切换,可以将JSF和Tapestry一起考虑。
      另外,JSF/Tapestry不只是支持Html,也支持多种客户端语言如WML或XUI等。
      这三者之间关系:如果说Struts是左派;那Tapestry则是右派;而JSF则是中间派,中庸主义是SUN联盟的一贯策略。

  • Issue in using JSF and tiles

    Hai,
    I am using JSF and tiles in my application along with richfaces 3.2 jar but the suggestion box does not work when i use incorporate tiles to the jsp page,Please help me out.Here is my code
    Content Page
    <%@ taglib prefix= "f" uri="http://java.sun.com/jsf/core"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"  %>
    <%@ taglib uri="http://java.sun.com/jsf/core"   prefix="f"  %>
    <%@ taglib uri="http://java.sun.com/jsf/html"   prefix="h"  %>
    <%@ taglib uri="http://jakarta.apache.org/tiles"  prefix="tiles"  %>
         <f:view >
             <link href="<%=request.getContextPath()%>\styles\Form.css" rel="stylesheet" type="text/css"/>
             <link href="<%=request.getContextPath()%>\styles\Menu.css" rel="stylesheet" type="text/css"/>
             <link href="<%=request.getContextPath()%>\styles\Header.css" rel="stylesheet" type="text/css"/>
             <title><h:outputText value="Brand"/></title>
             <h:form id="testForm">
                 <tiles:insert definition="test_create" flush="false"/>
             </h:form>
         </f:view>JSP
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <f:subview id="come">
    <body>
    <h:form>
    <h:outputText value="Provider:" styleClass="SubTitle" />
    <h:inputText value="#{testMBean.property}" size="25" id="dpiSuggest" styleClass="SubTitle">
        <a4j:support event="onkeyup" />
    </h:inputText>   
    <rich:suggestionbox for="dpiSuggest" suggestionAction="#{testMBean.suggest}" height="180" width="180" var="suggest">
    <h:column>
    <h:outputText value="#{suggest.countryName}" />
    </h:column>
    <h:column>
    <h:outputText value="#{suggest.countryCode}" />
    </h:column>
    </rich:suggestionbox>
    </h:form>
    </body>
    </f:subview>
    </html>
    *tiles.xml*
    <tiles-definitions>
        <definition name="header-menu-content" path="/layout/basicLayout.jsp">
            <put name="gridClass"           value="headerMenuContent"/>  
            <put name="headerClass"         value="HeaderBgcolor"/>
            <put name="menuColumnClass"     value="MenuBorder"/>
            <put name="contentColumnClass"  value="BodyBgColor"/>
        </definition>
        <definition name="home" extends="header-menu-content">
            <put name="header"  value="/common/header.jsp"/>
            <put name="menu"    value="/common/menu.jsp"/>
            <!--<put name="buttonBar" value="/common/buttonBar.jsp"/>-->
            <put name="content" value="/common/home.jsp"/>     
        </definition>
        <definition name="error" extends="header-menu-content">
            <put name="header"  value="/common/header.jsp"/>
            <put name="menu"    value="/common/menu.jsp"/>
            <!--<put name="buttonBar" value="/common/buttonBar.jsp"/>-->
            <put name="content" value="/common/error.jsp"/>     
        </definition>
            <definition  name="test_create" extends="header-menu-content">
                 <put name="header" value="/common/header.jsp" />
                 <put name="menu" value="/common/menu.jsp" />
                 <!-- <put name="buttonBar" value="/common/buttonBar.jsp"/>-->
                 <put name="content" value="/test.jsp" />
             </definition>
        <tiles-definitions>
    *web.xml*
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>welcome.jsp</welcome-file>
            </welcome-file-list>
             <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
      </context-param>
      <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>
    <context-param>
      <param-name>org.richfaces.SKIN</param-name>
      <param-value>blueSky</param-value>
      </context-param>
    <filter>
      <display-name>RichFaces Filter</display-name>
      <filter-name>richfaces</filter-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>
      </filter>
    <filter-mapping>
      <filter-name>richfaces</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      <dispatcher>REQUEST</dispatcher>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>
            <servlet>
          <servlet-name>Tiles Servlet</servlet-name>
          <servlet-class>org.apache.tiles.servlets.TilesServlet</servlet-class>
          <init-param>
             <param-name>definitions-config</param-name>
             <param-value>/WEB-INF/tiles.xml</param-value>
          </init-param>
          <load-on-startup>2</load-on-startup>
       </servlet>
        </web-app>
    *facesconfig.xml*
    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config version="1.2"
                  xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
        <navigation-rule>
                <navigation-case> <!-- Displayes the screen to add data -->
                <from-outcome>test</from-outcome>
                <to-view-id>/testContent.jsp</to-view-id>
                <redirect/>
            </navigation-case>
        </navigation-rule>
        <managed-bean>
            <managed-bean-name>testMBean</managed-bean-name>
            <managed-bean-class>testMBean</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
      </faces-config>Edited by: SreeramIyer on May 29, 2008 4:50 AM

    Are you dead set on using tiles? I can see tiles including JSF but JSF including tiles? Not sure if that will work.
    My suggestion is to use Trinidad. It has the concept of Regions which is very "tiles" like and you will be far more successful.

  • Using JSF and tiles

    Hi Friends,
    I'm trying to combine JSF and tiles as follows:
    Template file:
    <f:subview id="content">
    <tiles:insert attribute="content" flush="false"/>
    </f:subview>
    content file:
    <tiles:insert definition="userSpecific">
    <tiles:put name="content" type="string" >
    <h:outputText value="aaaa"/>
    </tiles:put>
    </tiles:insert>
    I get the following error when loading the content file:
    2007-06-20 10:14:10,578 [http-8080-Processor23] ERROR org.apache.myfaces.shared_impl.taglib.UIComponentTagUtils - Component javax.faces.component.UIViewRoot is no ValueHolder, cannot set value.
    I tried putting the template content in a verbatim tag and then it works
    but the content page is not displayed in correct place in the template...
    Thanks a lot in advance!

    Are you dead set on using tiles? I can see tiles including JSF but JSF including tiles? Not sure if that will work.
    My suggestion is to use Trinidad. It has the concept of Regions which is very "tiles" like and you will be far more successful.

  • JSF / Struts - I can't see attributes of my form.

    Hi,
    i've a problem with JSF. I'm using struts in my projects and I need to use a JSF component. So, i integrated JSF & Struts using struts-faces.jar. I converted my jsp file and I succeeded to fill combos but when I submitted form I can't get attributes of my form in action. ( i can see but all of them are null)
    Anybody help me?
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="/WEB-INF/struts-faces.tld" prefix="s"%>
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <%@taglib uri="http://www.ibm.com/jsf/rte" prefix="r"%>
    <script>
         function gonder() {
              if ( confirm('E-Postay&#305; göndermek istedi&#287;inizden emin misiniz?') ) {
                   document.forms[0].action = "/Admin/admin/testMail.do?method=kurumUygulamaGonder";
                   //alert("document.forms[0].elements['_id0:konu'].value : " + document.forms[0].elements['_id0:konu'].value);
                   document.forms[0].submit();
    </script>
    <f:view>
         <body>
         <hx:scriptCollector id="scriptCollector1">
              <s:form action="/admin/testMail" >
                   <jsp:include page="/common/header_center.jsp" />
                   <center>
                   <fieldset style="width: 80%">
                        <table border="0" align="center" id="oddEvenTable" width="98%">
                             <tbody>
                                  <tr class="listOddEven">
                                       <td><h:outputText value="Kurum" /></td>
                                       <td><br>
                                            <h:selectManyListbox styleClass="selectManyListbox"
                                       id="kurumlar" value="#{mailForm.kurumlar}" size="7">
                                       <f:selectItems
                                            value="#{selectitems.requestScope.kurumList.kurumAdi.kurumAdi.toArray}" id="selectItems0" />
                                  </h:selectManyListbox>
                                       </td>
                                       <td></td>
                                       <td><h:outputText value="Uygulama" /></td>
                                       <td>
                                            <h:selectManyListbox styleClass="selectManyListbox"
                                       id="uygulamalar" value="#{mailForm.uygulamalar}" size="7">
                                       <f:selectItems
                                            value="#{selectitems.requestScope.uygulamaList.uygulamaAdi.uygulamaAdi.toArray}"
                                            id="selectItems1" />
                                  </h:selectManyListbox>                         
                                       </td>
                                  </tr>
                                  <tr class="listOddEven">
                                       <td><h:outputText value="Konu" /></td>
                                       <td colspan="4"><h:inputText id="konu" size="118" value="#{mailForm.konu}"/></td>
                                  </tr>
                                  <tr class="listOddEven">
                                       <td><h:outputText value="&#304;çerik" /></td>
                                       <td align="center" colspan="4"><r:inputRichText width="702"
                                            height="352" id="content" value="#{mailForm.content}"></r:inputRichText>
                                       </td>
                                  </tr>
                                  <tr class="listOddEven">
                                       <td colspan="5" align="center" valign="middle">
                                       <hx:commandExButton
                                                 type="button" value="Gönder" styleClass="commandExButton"
                                                 id="btnKriterlereGoreAra" onclick="gonder()">
                                            </hx:commandExButton>
                                       </td>
                                  </tr>
                             </tbody>
                        </table>
                   </fieldset>
                   </center>
              </s:form>
    </f:view>

    Settings>Mail, Contacts, Calendars>Show
    http://i1224.photobucket.com/albums/ee374/Diavonex/382b7c7505f26ac775b54ce257655 5b4.jpg

  • JSF & Struts

    After reading several articles about JSF and Struts,
    where opinions concur and also differ,
    I would like to get an opinion from this list regarding starting a new project.
    If I start a new project, should I even bother to
    consider Struts, or should I just use JSF?
    Most of the comments that I've seen are about recommendations for migrating Struts to JSF (specially the
    html part). How about starting a brand new project?
    Will it be OK if I only use JSF? Will there be
    a lot of work if I start with JSF and later decide
    to replace some of the pieces with Struts?
    I'd appreciate some comments.
    gs

    I think any project started today with implementation schedule early next year should be focused on Struts (like Jonathan said earlier). If you are in the exploritory stages of an implementation that will probably finaly deliver in '05 then I'd say JSF is the way to go. My reasoning is based on the industry support that was apparent at JavaOne and all the buzz. Most, if not all, J2EE servers will have JSF by sometime in '04 and I susspect that by late '05 many execs will be wondering why they allowed Struts to be used...
    Not that there is anything wrong with Struts. Its great and has a lot of mind share (books, knowledge base etc), its really cool, and fun to work with, it does a reasonable job of separating the view from the model etc. Its good stuff. But since out of the box app servers will support JSF, Struts will be less and less important from an enterprise perspective. I susspect that this will really happen in full force when JSF becomes part of the J2EE spec (just speculation on my part, but it seems reasonable given the 'http://java.sun.com/j2ee/javaserverfaces' url :-).
    This is of course only my $0.02 worth...
    TTFN,
    -bd-
    http://bill.dudney.net/roller/page/bill

  • No support (wizard) for JSF & struts portlets

    I can create portlets (JSR 286 & Oracle PDK-Java) in JDevelopers. However I feel the wizard is not mature. I can only create one kind of portlet (JSR 286) using JDeveloper if we consider only standards based portlet - this portlet is called Java portlet in WebLogic. Can't create JSP, URL etc protlets, even no support (wizard) for JSF & struts portlets...
    Is there anyway to enable these features?
    Thanks.

    Check below link if useful
    http://docs.oracle.com/cd/E17904_01/portal.1111/e10238/pdg_java_adv.htm#CHDFAHEC
    http://docs.oracle.com/cd/E12524_01/webcenter.1013/e12434/jpsdg_java_adv.htm#CHDFAHEC
    Edited by: ngsankar on Jun 6, 2012 10:56 AM

  • UIX event handler + struts

    Hi,
    I'm using UIX + struts in jdev10g and im getting problems trying to handle a simple action binding event like the "Next" operation. Below is a short example of what im trying to do.
    Test.uix
    <submitButton text="Next" model="${bindings.Next}" id="Next2" event="next"/>
    <event name="next" source="Next2">
    <invoke method="doIt" javaType="oracle.jbo.uicli.binding.JUCtrlActionBinding"
    instance="${bindings.Next}"/>
    </event>
    testAction.java
    public void onNext(DataActionContext ctx)
    if (ctx.getEventActionBinding() != null)
    ctx.getEventActionBinding().doIt();
    If i run the code above i can see that it executes ctx.getEventActionBinding().doIt(); but the action binding never gets executed, and this efect is the same for other actions like create,previous etc...
    Another thing that calls my attention is that every time i drag a operation from the DataControl Palette the event name is always "action"
    <submitButton text="First" model="${bindings.First}"
    id="First0" event="action"/>
    So how is the correct way to handle events in the UIX + Struts?????
    Please i need a help on this one!!!!!
    Tanks,
    Eduardo M. Sasso

    First of all tanks for the help.
    But what i want to do is to subclass the DataForwardAction for my DataPage and let the struts controller handle the event, just like the documentation says...
    About Event Handling in Applications Using Oracle ADF, UIX, and Struts
    http://helponline.oracle.com/jdeveloper/help?topic=adf_auixadfevents_html
    If i try to do the same thing using jsp it works great...
    This is problem is getting me nuts!!! it looks to me that this problem is very easy to solve but i just cant see the solution....
    tanks again

  • Struts tiles to create event based loading of tiles on a JSP

    Hi All,
    I am working on a web app where I am using struts tiles to create my JSPs. I have tiles for header, footer & nav bar.
    Now I want to break up my JSP body in multiple tiles. It is required that I insert only one body tile initially, say body1, which contains few hyperlinks. Depending on which link is clicked, I would attach another tile (body2) below the first one. Can any advanced tiles user inform me if it's possible with struts-tiles, & if yes how?
    Thanks.

    Tiles is basically used to overload the jsp pages and reuse them.
    In your tiles-defs.xml file:
    //Tiles for header, footer and nav bar goes here
    //Tiles for body1 and body2  goes here
    <definition name="BodyTile" page="/yourPage.jsp">
              <put name="body1" value="/blank.jsp" />
              <put name="body2" value="/blank.jsp" />
    </definition>
    <!--Blank jsp is a simple html page without any data into it-->
    Now create a customized tile for your module. Mapping has to be done in struts-config.xml.
    Notice that the definitions here extend the tile from tiles-defs.xml, i.e. "BodyTile"
    <definition name="ActionOneWithBodyOne" extends="BodyTile">
        <put name="body1" value="/yourPage1.jsp" />
    </definition>
    <definition name="ActionTwoWithBodyTwo" extends="BodyTile">
        <put name="body1" value="/yourPage1.jsp" />
        <put name="body2" value="/yourPage2.jsp" />
    </definition>Now when you first load the page forward it to "ActionOneWithBodyOne" and it displays you just your body1.
    When ever u click a link on body 1, after performing the action populate the form bean corresponding to yourPage2.jsp and forward the action to "ActionTwoWithBodyTwo".
    Hope that helps!!
    SirG

  • STRUTS and UIX: How to use getCustomMethod in event handler

    I am having app module method exposed to a client as my custom method that does something. Then I have a data page (UIX) with a submit button that triggers event handler:
    public void onMyEvent(DataActionContext ctx) {
        HttpServletRequest request = ctx.getHttpServletRequest();
        HttpSession session = request.getSession();
        JUCtrlActionBinding method = ctx.getCustomMethod();
        if (method == null) System.out.println("method is null!!!!!!!!!!!");for some reason my method handle is null WHY???
    this seems to work when I call my method from findForward() though.

    If you use ADF BC, you can override the method create(AttributeList) in the Entity Object implementation class (EmployeesImpl.java).
    Use: Menu --> Tools --> Override Methods --> create
    In the overridden create method you can assign the next value from a DB sequence (e.g. EMP_SEQ) to the ID attribute:
    protected void create(AttributeList nameValuePair) {
    // Super
    super.create(nameValuePair);
    // Id
    SequenceImpl s = new SequenceImpl("EMP_SEQ", getDBTransaction());
    setEmployeeId(s.getSequenceNumber());
    }

  • XMLBeans vs Struts Tiles

    Right now I am working on a product which is developed using XMLBeans, XSL, Transformer etc. My opinion is that this can be simplified by using struts tiles. Please give me your opinions. Which is better leaving as it is or redesigning

    I'm not a fan of Struts Tiles, IMHO it's only slightly better than raw JSP and has some nasty issues regarding exception handling. Having said that I'm also not a fan of using XSL to render web pages unless there are extremely good reasons for doing so (e.g. multi channel delivery).
    Maybe take a look at some of the other presentation frameworks around...tapestry, velocity, Spring MVC, jsf etc.

Maybe you are looking for

  • How do I find and play a audiobook sample on my iPad

    HElp I cannot find or play a sample I downloaded of an audiobook.

  • End user receving same mail , twice in a day .

    Hi, Throu this report , i am sending mail to a user. I the scheuld this program as background job. But My problem is end user receving same mail twice a day.I am sure , Program is executed onces in day. Plz help me to solve the problem REPORT  zplm00

  • Nsert/Update and Add Column at the same Table and at the "same" Time

    Hello, I want Insert/Update and Add Column at the same Table and at the "same" Time but in different sessions. Example: At first the "insert/update" statement: Insert into TestTable (Testid,Value) values (1,5105); After that the "add" statement: Alte

  • Cant download adobe flash player

    I have tried everything reccomended, i still cant download adobe flash player, it says error/ access denied Please help.......

  • Merging Columns In ALV

    Hi My requitrement is that i want to merge Columns (not Rows) in my ALV layout. the condition is that i have to merge columns of only 1 row of my layout. Cell_Merge will Merge Rows but how can i merge columns suitable points will be awarded. with reg