Custom ViewHandler

is this enough and right way to create custom ViewHandler -
public class CustomLocaleViewHandler extends ViewHandlerWrapper {
protected ViewHandler getWrapped() {
return new CustomLocaleViewHandler();
i don't get any compilation error.
however it gives stack over flow error at run time -
java.lang.StackOverflowError
     at javax.faces.application.ViewHandler.(ViewHandler.java:70)
     at javax.faces.application.ViewHandlerWrapper.(ViewHandlerWrapper.java:62)
     at com.lr.bos.lifecycle.CustomLocaleViewHandler.(CustomLocaleViewHandler.java:17)
     at com.lr.bos.lifecycle.CustomLocaleViewHandler.getWrapped(CustomLocaleViewHandler.java:20)
     at javax.faces.application.ViewHandlerWrapper.calculateRenderKitId(ViewHandlerWrapper.java:117)
     at javax.faces.application.ViewHandlerWrapper.calculateRenderKitId(ViewHandlerWrapper.java:117)
     at javax.faces.application.ViewHandlerWrapper.calculateRenderKitId(ViewHandlerWrapper.java:117)
what other methods i should override?
thanks.

To extend WebCenter Portal View Handler you have to:
1) Create a class extending oracle.webcenter.portalframework.sitestructure.handler.CustomViewHandler
public class ApplicationViewHandler extends CustomViewHandler {
     * Constructor
     * @param viewHandler
    public ApplicationViewHandler(ViewHandler viewHandler) {
        super(viewHandler);
}2) Register it in faces-config as follow:
<application>
    <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
    <view-handler>com.merchan.portal.util.ApplicationViewHandler</view-handler>
</application>3) You can override all the methods that you want: Sample:
    * Extend to address issue with bug 11076967 involving login
    @Override
    public String getActionURL(FacesContext fctx, String viewId) {
        String urlStr = viewId;
        if (Beans.isDesignTime()) {
            return this.m_baseHandler.getActionURL(fctx, urlStr);
        // Only perform the pretty url lookup if the request was from our
        // navigation processAction
        if (isRequestDrivenByNavigation(fctx)) {
            SiteStructure model =
                SiteStructureContext.getInstance().getCurrentModel();
            if (model != null) {
                SiteStructureResource resource = model.getCurrentSelection();
                if (resource != null) {
                    String resourceViewId = findTargetViewId(fctx, resource);
                    if (resourceViewId != null &&
                        resourceViewId.equals(viewId))
                        urlStr = "/" + SiteStructureUtils.encodeUrl(resource.getPrettyUrl());
        String ret = this.m_baseHandler.getActionURL(fctx, urlStr);
        return ret;
    }Regards.

Similar Messages

  • BUG? - Unable to configure custom viewhandler

    Hi.
    I'm experiencing difficulties with my attempt to configure a custom viewhandler, i.e. by sub-classing the ViewHandlerImp class.
    My plan was to use the viewhandler to switch render kit IDs, based on the URL mapping.
    It is possible to do this when using MyFaces but it seems that with ADF Faces there is no ViewHandler that can be subclassed, i.e. ADF faces has it's own ViewHandler implementation.
    I attempted to subclass the org.apache.myfaces.application.jsp.JspViewHandlerImpl class, overriding the CalculateRenderKitId() method to return "oracle.adf.core" as the kit id.
    This is all that is needed with MyFaces, i.e. returning "HTML_BASIC" when loading a MyFaces jsp page, with the correct mappings, works OK.
    There then should be no need to specify the default kit id, i.e. via:
    <default-render-kit-id>
    oracle.adf.core
    </default-render-kit-id>
    in the faces-config.xml file, i.e. you can then switch render kits at will in order to plug in rendering for different output formats based on the file extension mapping *.jspx, *.jspw, to switch, for example between HTML, WML, SVG output formats.
    I also tried to subclass the oracle.adfinternal.view.faces.application.ViewHandlerImpl class but this doesn't seem possible since it doesn't have a parameterless base constructor and there is no documentation.
    Is there any way of doing this or is there a fix for this in the pipeline?
    I am using Apache MyFaces with EA19.
    Thnks..

    I got different setting advise from verizon store, verizon online and from charter.  all said something different.  I eventually got it to work using the regular pop.charter.net for incoming and smtp.charterinternet.com for outgoing.  No secure connection...  no verification certificate...  and the port is 25.  I have a droidX also.

  • JSF 1.1 Custom ViewHandler to add Components dynamically

    Hi,
    I need to add UIComponents dynamically on each JSF view.
    Using JSF 1.2, i can write a custom ViewHandler and override createView, like :
        public UIViewRoot createView(FacesContext facesContext, String viewName) {
            UIViewRoot viewRoot = baseViewHandler.createView(facesContext, viewName);
            UIComponent component = facesContext.getApplication().createComponent( HtmlInputText.COMPONENT_TYPE );
            HtmlInputText hidden = ( HtmlInputText ) component;
            hidden.setId("myID");
            hidden.setValue("myValue");
            viewRoot.getChildren().add( component );
            DebugUtil.printTree( viewRoot, System.out );
            return viewRoot;
        }But with JSF 1.1, and deploying the webapp on OC4J 10.1.3.3.0, my dynamic component (the hidden field) is not rendered..
    NB : the dynamically added component is not rendered but it is listed by DebugUtil.printTree( )
    The printTree output looks like :
    08/11/25 19:47:47 id:null
    value= null
      id:eventlist
      value= WWFWhy is the ViewHandler's behavior different between JSF 1.1 and 1.2 ?
    How can i achieve dynamic component addition (for all pages) with JSF *1.1* ?
    Thank you for your answers.
    Edited by: ju_l_ien on Nov 25, 2008 11:58 AM

    Hi All,
    We don't want to use BOM options.
    I have also checked "No. of packages'` at header level but my requirement is at item level.So we are also exploring the option of  APPEND  standard table and add this field.
    Kindly let me know  if we can do it without Appending standard table.
    Regards,
    Field to add to enter number of items which are  shipped to customer 

  • Setting component attributes through viewhandler

    We need to tag each component in a view with a specific attribute.
    We are not allowed to inherit and customize the encoding of the components through custom renderer.
    Is it possible to tag the components in the tree ,through a custom viewhandler or phaselistener, prior to the rendering?
    We find that the phaselistener can get the entire component tree only after the RENDER_RESPONSE phase.
    Is ther any other way of achieving this objective?

    You might find this post useful: http://blogs.adobe.com/flexdoc/2010/08/creating-flex-view-states-in-actionscript.html

  • RenderKitId and ViewHandler in JSF1.2

    I've been reading the JSF 1.2 spec, and I am a bit confused about how the ViewHandler interacts with the view's renderKitId.
    From the JSF 1.2 Final Draft (May 2006), Section 9.4.20 (f:view) indicates that the renderKitId attribute is set in this order:
    1) user supplied value
    2) Application.getDefaultRenderKitId if not null
    3) RenderKitFactory.HTML_BASIC_RENDER_KIT
    Section 7.5.1 (View Handler) indicates that the ViewHandler .createView calls .calculateRenderKitId "to find out which renderKitId should be used for rendering the view."
    Section 2.4.2.2 (Configure the Desired RenderKit) indicates "the default ViewHandler must call calculateRenderKitId() on itself and set the result into the UIViewRoot's renderKitId property."
    Does this mean that it is the responsibility of the default ViewHandler .calculateRenderKitId method to follow the steps described in section 9.4.20 for determining the renderKitId to put on the UIViewRoot?
    I'm trying to figure this out because I want to know how a custom ViewHandler should act.
    I created a ViewHandler implementation for JSF 1.1_01 which delegated everything except .calculateRenderKitId. In .calculateRenderKitId, I determine the type of device that is connecting. If it is a "telnet device" (actually a server sitting between the telnet emulator and the application), I return the renderKitId for a telnet RenderKit. Otherwise, I would delegate (which, in the default case, the default-render-kit-id in faces.config.xml would be used).
    I'm trying to figure out how similar functionality would work with JSF 1.2. Ideally, a user-supplied value for the f:view renderKitId should be used if present. Only if it is not present should I check for the telnet device, and, if not, then delegate.
    But if my understanding of the JSF 1.2 spec is correct, I would be "interjecting" myself in the middle of the standard processing.

    Some people have indicated that they have had success making custom component out of existing components by using a delegation strategy for rendering, decodes, etc.
    Alternatively you might need to override the state saving and restore methods to overcome your problems with your existing code.
    Another possibility is to use a page fragment, if you are using Facelets or another templating library which supports it.

  • ER - Problem with ADF Faces filter when running ADF Faces within a portlet

    I am attempting to get ADF Faces to run within Oracle Portal, i.e. within a portlet using the JPDK.
    This, I am sure you are about to tell me, is not something that is fully supported, as yet.
    However, I have been successful in getting MyFaces to run within a portlet, by customizing the form tag.
    MyFaces, it seems, keeps track of the current viewid by storing it in the session, then uses this within the viewhandler and navigationhandler to determine the next view to load, based on the faces-config.xml navigation entries.
    By customizing the form tag it is then possible to retrieve this viewid from the faces context and outputting it in the form's action parameter.
    It is also possible, with a few more customizations, to run JSF RI within a portlet, i.e. by adding a custom viewhandler and loading a session variable with the current viewid from the faces context, then retrieving the viewid and outputting it as the action string in the customized form tag .
    Unfortunately there does not appear to be any way of getting ADF Faces (EA19 version) to run as a portlet, with either the RI or with MyFaces.
    I have configured a basic .jspx document in the <showPage> tags of the provider.xml file.
    This uses only the form tag and a few input tags and works when executed directly within my portlet project in JDeveloper (http://localhost:8988/TestJSFAppContext/faces/htdocs/facesportlet/index.jspx) using a redirectfilter (*.jspx htdocs -> /faces/htdocs).
    It is not possible to run ADF Faces with RI as a portlet since customization of the ADF Faces ViewHandler appears not to be supported.
    When attempting to run this with MyFaces as a portlet, however, I get the following message:
    oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl verifyFilterIsInstalled
    WARNING: The AdfFacesFilter has not been installed. ADF Faces requires this filter for proper execution.
    I am having difficulty in understanding as to why this is happening but am guessing it must be something to do with either redirect URLs or due to the .jspx files being under /htdocs, i.e. the ADF Faces renderkit is checking that the ADF Faces filter is configured but the check fails since the filter does not execute.
    I have configured the filter in web.xml, as detailed in the documentation:
      <filter>
        <filter-name>adfFaces</filter-name>
        <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>adfFaces</filter-name>
        <servlet-name>ADF Faces Servlet</servlet-name>
      </filter-mapping>
    <servlet>
        <servlet-name>ADF Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>ADF Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>and have modified the provider.xml file as follows:-
          <renderer class="oracle.portal.provider.v2.render.RenderManager">
             <renderContainer>true</renderContainer>
             <renderCustomize>true</renderCustomize>
             <autoRedirect>true</autoRedirect>
             <contentType>text/html</contentType>
      <showPage>/faces/htdocs/facesportlet/index.jspx</showPage>        
             <editPage>/htdocs/facesportlet/FacesportletEditPage.jsp</editPage>
             <editDefaultsPage>/htdocs/facesportlet/FacesportletEditDefaultsPage.jsp</editDefaultsPage>
          </renderer>with the following tags also set:
       <session>true</session>
       <passAllUrlParams>true</passAllUrlParams>In order to ensure that the session stays alive so that the views are retrieved.
    As I say, the page loads OK when run directly within the JPDK project within JDeveloper, with a redirect filter (*.jspx -> /faces/*.jspx) but not when run from within Oracle Portal.
    In fact I have found that this filter is very sensitive, i.e. ADF Faces will not run in any project unless the configuration is exactly as above.
    It seems that the MyFaces team have got around the problem of maintaining session state with redirections but that ADF Faces needs the page URL that is passed in to the filter to be consistent.
    Is there some way around this, i.e. some kind of customization that I can implement to get the filter working?
    Thnks

    I have found a way to go round the problem.
    I use the servlet 2.4/jsp 2.0 route and then
    change the web.xml header to the servlet 2.3/jsp 1.2
    format. Everything then works fine after this!
    Please fix this for production.
    Behnam

  • Tree2 in Tomahawk  and JSF Tiles Implementation

    hi All,
    right now i mfacing one problem. which arise due to tiles implementation in JSF with Tree2 component of Tomahawk. i had created one tree menu using Tree2.
    its working fine, but i was not able to highlight selected child node of tree menu as i m using tiles implementation so all pages gets reloaded on every click on jsp. thus color of that selected node becomes as it is.
    please note that i m using myfaces implementation.
    what i have written is as below:
    <t:tree2 id="wrapTree" value="#{frontPage.catTree}" var="node" clientSideToggle="true"
                             showRootNode="false" varNodeToggler="t">
                                  <f:facet name="parent-one">
                                  <h:panelGrid id="parentOne" columns="1" cellpadding="0" cellspacing="0" border="0">
                                            <h:commandLink styleClass="textorg" immediate="true" action="#{categoryListBean.showCategoryDetail}">
                                  <h:outputText escape="false" value="#{node.description} "/>
                                       <f:param name="categoreId" value="#{node.identifier}"/>
                             </h:commandLink>
                                  </h:panelGrid>
                   </f:facet>
                   <f:facet name="top-parent">
                   <h:panelGrid id="topParent" columns="1" cellpadding="2" cellspacing="0" border="0" align="left">
                   <h:commandLink styleClass="txtbold" immediate="true" action="#{categoryListBean.showCategoryDetail}">
                   <h:outputText escape="false" value="#{node.description} "/>
                   <f:param name="categoreId" value="#{node.identifier}"/>
                   </h:commandLink>
                   </h:panelGrid>
                   </f:facet>
                   <f:facet name="child">
                   <h:panelGroup id="Child">
                             <h:commandLink styleClass="#{t.nodeSelected ? 'headerRedText':'txt1'}" actionListener="#{t.setNodeSelected}" immediate="true">
                   <h:outputText value="#{node.description}"/>
                        <f:param name="categoreId" value="#{node.identifier}"/>
                   </h:commandLink>
                   </h:panelGroup>
                   </f:facet>
                             </t:tree2>
    please help me if u have solution of this problem.
    thank you.

    hi,
    in MyFaces there is an example using JSF and Tiles.
    MyFaces provides a custom ViewHandler faciltity.
    see http://sourceforge.net/projects/myfaces
    hope that helps.
    Regards,
    Matthias

  • JSF Tiles and Struts ActionForward

    Hi All
    I would like to use Tiles with my JSF application.
    In order to get the best from Tiles i would like to use definitions.
    the problem that most of the power of Tiles and definitions is coming from the use of ActionForward.
    Does any one now how i can implement ActionForward with struts definition name in the Navigation in JSF.
    I understand that i need to hack the Navigation model and get the Tiles bean from the Tiles using the outcome value.
    Then i know that i need some how to get the tree that generates and forward it to the JSF or somthing like this.
    Does any one have an idea how to do it???
    Thanks
    Noam

    hi,
    in MyFaces there is an example using JSF and Tiles.
    MyFaces provides a custom ViewHandler faciltity.
    see http://sourceforge.net/projects/myfaces
    hope that helps.
    Regards,
    Matthias

  • Chainging L&F on the fly

    Hi everyone
    I know that changing the L&F on the fly is not recommended so in my application I want to provide a small preview window for the L&F selected. The problem I'm having is using third party L&F's such as metouia and kunststoff. When I change from one of these to metal or the other way around the colours bleed through. I know this is a problem becuase they are derived from the metal L&F, but I was wondering whether there was any way of making the updates work correctly.
    Also as the application would need to be restarted is there any way of doing this programatically?
    Any help is most appreciated.
    Good Day To You
    Adam

    Great!
    I have read your book and the custom ViewHandler seems to be the solution for my problem. However the examples I have downloaded from your site did not work. As you site recommends I copied the folder jsfbook in the Tomcat's 5.1.19 webapps folder and uncommented the ViewHandler tags of the faces-config.xml but when I try to run the examples of the chapter 15 I get the following error:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.IllegalArgumentException: Unrecognized Content Type.
         com.sun.faces.renderkit.RenderKitImpl.createResponseWriter(RenderKitImpl.java:143)
         com.mycompany.jsf.pl.ClassViewHandler.setupResponseWriter(ClassViewHandler.java:218)
         com.mycompany.jsf.pl.ClassViewHandler.renderView(ClassViewHandler.java:114)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    note The full stack trace of the root cause is available in the Tomcat logs.
    How can I fix it?

  • JDeveloper 10.1.2.0.0 - Inner class cannot be found

    Hi!<br>
    <br>
    I use Apache MyFaces 1.1.1 (Nightly Build 20051130) to create a Web app and imported all necessary libraries. I want to write a custom ViewHandler at the moment and experience a strange problem. I want to use a public inner class of javax.faces.application.StateManager, named SerializedView, but this class cannot be found when I try to import it with the following statement:<br>
    import javax.faces.application.StateManager.SerializedView;<br>
    JDeveloper just says: <br>
    Imported class 'javax.faces.application.StateManager.SerializedView' not found<br>
    I already successfully use many other javax.faces classes, like StateManager...<br>
    Any help would highly be appreciated, since this is a real blocker for me.<br>
    <br>
    Regards,
    Matthias

    Hi again!<br>
    <br>
    The problem is solved for the most part now. Compilation works fine, although the Java editor says the class SerializedView cannot be found.<br>
    <br>
    So the Java editor's behavior is still strange...<br>
    <br>
    Regards,<br>
    Matthias

  • Where/How do I programmatically build the component tree?

    Hi! I'm having a lot of problems trying to make my JSF application work...
    Here's the situation:
    - I have to display a form (questionnaire) consisting of a tree (form - subforms - sections - groups - questions - checkboxes/dropdowns...). Each of these parts are custom components, with custom renderers.
    - This display is only a small part of a wider application (so the custom ViewHandler solution seems impossible to me), and it is done in an imported jsp (using <jstl:import ...>). In this jsp, there is only one component, representing the "root" of the questionnaire, because the structure of the questionnaire is unknown at the beginning.
    - I need to build programmatically (in Java) the component tree of my questionnaire (according to the structure loaded from a database) and integrate it in the component tree of the whole application.
    - The problem is I can't get this to work properly in the JSF lifecycle (either the restoreState/saveState methods aren't called, or the "main" tree doesn't contain my "sub-tree" although everything is rendered properly...). I searched on a lot of forums, I tried a lot of solutions (new UIComponent() vs. application.createComponent(...) / create the tree in the component constructor vs. in the component renderer... ) but none of them seemed to meet my requirements, since it seems to be a tricky situation.
    So, does anyone knows how to achieve this? How and where to build my component tree?
    (ask me if a you need more information about my code!)
    Thanks in advance!!
    Adriano

    Bit_happens wrote:
    - I'm using the "createComponent" method to build my tree (instead of just calling the component constructor), is that right? For example:
    UISubform subformComponent = (UISubform) application.createComponent(UISubform.TYPE);
    //UISubform subformComponent = new UISubform();What is the difference with the plain constructor call?You are not implementation dependent then.
    - Apparently, I have to explicitly add the panelGroup to the component tree, or else it won't be part of the tree. Is that normal? Shouldn't JSF add it to the tree automatically when it finds it in the JSP? I have to do the following:
    UIComponent parent = facesContext.getViewRoot().findComponent("form_subview").findComponent("main_form");
    parent.getChildren().add(panel);
    panel.setParent(parent);- Is there a difference between creating the "sub-tree" in an ascending way, or in a descending way? I.e. first creating the leaves and then going up the branches until I plug the root component into the main tree, or first creating the root component and then going down the branches until all the leaves are created?No, there isn't.
    - I think my custom components themselves should be right, and they're declared in faces-config. It looks like the panelGroup doesn't renders its children, but it should by default, right? When I look at the rendered page source code, the panelGroup is empty:
    <span id="form_subview:main_form:formPanel"></span>- Do you think of anything else I should check? Any tricky setting I could have forgot?Try adding existing components to the panelGroup, e.g. HtmlOutputText. If that works, then I rather think there is a flaw in your component.

  • Catch exceptions that occur in the constructor of a managed bean

    Hello,
    I would like to catch exceptions that might occur in the constructor of a managed bean and redirect to an error page. My beans need to get data from a database and if the database is not accessible, an error page is to tell the user "try again later". I don't want to write an action or actionListener that is invoked by a button klick on the previous page to make error handling easier, because an actionListener should not know about the next page and what data the next page will need.
    I read all postings about this topic I could find in this forum. And there are three solutions I tried:
    1) register an error-page in web.xml
    Is there an example for using this in a JSF application? It did not work. I got a "Page not found" exception
    2) Use a phase listener. But how can a phase listener do this? Is there an example? I don't think it can do it in the beforePhase method because this method is called before the constructor of the managed bean is called.
    3) Use a custom ViewHandler. This is my renderView method which creates a "Page not found" Exception.
    public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException {
    ViewHandler outer = context.getApplication().getViewHandler();
    try {
    super.renderView(context, viewToRender);
    } catch (Exception e) {
    context.getExternalContext().redirect("/error.jspx");
    Several people write they've done it one or the other way. Please share your knowledge with us !!
    Regards,
    Mareike

    Hallo Mareike,
    Maybe I should abandon managed beans, create my own
    "unmanaged" ones inside of an action listener and put
    them somewhere my pages can find them.
    Its a pity, because I like the concept of managed
    beans.sure setter injection of JSF is fine!
    well workaround could be using <h:dataTable rendered="#bean.dbAccessible" ...>
    In your constructor you catch the exception and set
    dbAccessible = false;
    or you use error pages of webcontainer,
    but the pages couldn't contain JSF components, IMHO
    only plain JSP files.
    BTW perhaps somebody on MyFaces' list knows the solution:
    http://incubator.apache.org/myfaces/community/mailinglists.html
    Regards,
    Mareike-Matthias

  • How to add the ability to put EL expressions in Navigation Rules

    I had a need to dynamically determine what page to return to in a JSF application. There has to be an easier way, but here's how I wanted to do it. I wanted to put an EL expression in my <to-view-id> nav rules in the JSF config file (e.g. faces-config.xml). This isn't allowed. So I built my own custom ViewHandler to do it.
    1) Define the ViewHandler in faces-config.xml:
         <application>
              <view-handler>com.msd.tts.pluggable.MyDynamicViewHandler</view-handler>
         </application>2) Create the class:
    package com.msd.tts.pluggable;
    import java.io.IOException;
    import java.util.Locale;
    import javax.faces.*;
    import javax.faces.application.ViewHandler;
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.*;
    import javax.faces.el.ValueBinding;
    import com.sun.faces.util.Util;
    * Adds ability to put EL expressions in the <to-view-id> Navigation Rules in JSF
    * configuration file (faces-config.xml).
    * @author          Craig Peters
    * @version          1.0
    public class MyDynamicViewHandler extends ViewHandler {
         * The original handler we are customizing.
        private ViewHandler prevHandler = null;
        /** Creates a new instance of MappingViewHandler. By including
         * a parameter of the same type, we encourage the JSF framework
         * to pass a reference of the previously used ViewHandler. This way
         * we can use all the previous functionality and override only the
         * method we are interested in (in this case, the getActionURL() method).
         public MyDynamicViewHandler(ViewHandler prevHandler) {
              this.prevHandler = prevHandler;
         @Override
         public String getActionURL(FacesContext context, String viewId) {
              return prevHandler.getActionURL(context, viewId);
         @Override
         public Locale calculateLocale(FacesContext context) {
              return prevHandler.calculateLocale(context);
         @Override
         public String calculateRenderKitId(FacesContext context) {
              return prevHandler.calculateRenderKitId(context);
         @Override
         public UIViewRoot createView(FacesContext context, String viewId) {
              return prevHandler.createView(context, viewId);
         @Override
         public String getResourceURL(FacesContext context, String path) {
              return prevHandler.getResourceURL(context, path);
         @Override
         public void renderView(FacesContext context, UIViewRoot viewToRender)
                   throws IOException, FacesException {
              String result = viewToRender.getViewId();
              if (Util.isVBExpression(viewToRender.getViewId())) {
                   ValueBinding vb = context.getApplication().createValueBinding(viewToRender.getViewId());
                   result = vb.getValue(context).toString();
              if (result.charAt(0) != '/')
                   throw new IllegalArgumentException("Illegal view ID " + result + ". The ID must begin with '/'");
              viewToRender.setViewId(result);
              prevHandler.renderView(context, viewToRender);
         @Override
         public UIViewRoot restoreView(FacesContext context, String viewId) {
              return prevHandler.restoreView(context, viewId);
         @Override
         public void writeState(FacesContext context) throws IOException {
              prevHandler.writeState(context);
    }3) Use EL in navigation rules:
         <navigation-rule>
              <from-view-id>/CommonForm.jsp</from-view-id>
              <navigation-case>
                   <to-view-id>#{bean.caller}</to-view-id>
              </navigation-case>
         </navigation-rule>The "bean.caller" method will have saved the page to go back to.
    Comments are welcome. I just didn't see any other way to dynamically go back to an arbitrary page.
    Thanks.

    CraigRPeters wrote:
    Comments are welcome.Nice stuff. But that means that navigation is hardwired in the backing bean instead of faces-config.xml. Forget this comment if you've maintained a propertiesfile/configurationfile for that.
    I just didn't see any other way to dynamically go back to an arbitrary page.You can declare more than one from-outcome and/or from-action for one from-view-id.

  • Template based rendering

    The move from servlets to JSPs was a blessing so far as the presentation logic was concerned - one would essentially fill HTML templates with dynamic inputs thru Java scriplets.
    However, with the move toward a component oriented web world (leveraging JSF and other like technologies), it is one step backward w.r.t. rendering. One needs to emit the markup from the component Java code and even a minor change in the rendering of the component requires changing the Java code, re-compiling, et al.
    I remember sometime back I had read up on template based rendering for web components. The markup is generated (as is) off an external template (maybe, an XML file), with the component renderers merely "inserting" the dynamic inputs.
    I was wondering if there were plans for JSF to inherently support such template based rendering mechanisms or if there already existed an API which one could leverage alongside JSF?
    Thanks!

    You may be thinking of Barracuda, which basically does what you describe. Tapestry is similar.
    JSF can support this model as well, using a custom ViewHandler and RenderKits. Out-of-the box, though, the only "template" type that's supported is JSP with JSF custom actions.
    It's not as bad as you make it sound, since the JSP page can contain a lot of static HTML for layout and use CSS for styling, with just a few JSF action elements for tying in the JSF components. But if you want to change the HTML (or any other WL) that a component generates, then yes, you have to change the Java code (assuming we're talking about the default HTML RenderKit; other alternatives, e.g., with a template per component ala Tapestry, are possible).
    If time permits, I will develop a JSP alternative for JSF, inspired by Barracuda/Tapestry, for the book I'm writing about JSF.

  • URL folder alias

    hi... I've a webapp, and I want to get the language from the URL, I mean:
    http://server.com/myapp/en/page1.jspx
    or
    http://server.com/myapp/fr/page1.jspx
    All pages are facelets templates with locale message bundles, the xhtml file has references to a bean containing the message for every language, so each file will be the same for every language.
    I wrote a custom Viewhandler overriding the method calculateLocale() :
        @Override
        public Locale calculateLocale(FacesContext context) {
          String path = null;
            path = context.getExternalContext().getRequestServletPath();
            if (path.indexOf("/es/") > 0) {
                System.out.println("calc LOCALE FR-------------------");
                return new Locale("fr"); }
            else
                System.out.println("calc LOCALE EN-------------------");
                return Locale.ENGLISH;
        }What I'm looking for, is the way to create an alias for each language "folder" ... are there some rule that I can specify in faces-config.xml to achieve this ?..
    I remember some time ago, did something similiar over apache httpd.
    Edited by: sebaxtz on Oct 19, 2009 8:23 AM

    Thank you for you patience BalusC,
    I think I'm getting close to this issue. I did this little test inside a request Bean.
        public String getTest() {
            FacesContext ctx = FacesContext.getCurrentInstance();
            String lc=(String) ctx.getExternalContext().getRequestMap().get("aaaa");
            return lc;
        public void action() {
            FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("aaaa", "BBBBBBBB");
    #{beanx.test}
    <h:form>
        <h:commandButton value="submit" action="#{beanx.action}" />
    </h:form>
    </html>The attribute value "BBBBBBB" shows in the page when I press the button, but it nevers clear!!! It clears if close/reopen the browser, but not when retyping the address,refresing, nor openning the address in another tab.
    What am I missing ?
    thank you very much!

Maybe you are looking for

  • Optical audio output questions

    Concerning the optical digital out: (A) If something's connected to this port, does doing so disable audio through the HDMI output? (B) Someone in an Apple store said that the optical out is 'only' for 5.1 systems. Is this correct? I wanted to connec

  • Shipping condition in PO

    Hello When manually adding a line to a plant to plant PO (created from purreqs), the shipping condition on the additional line is sometimes showing 'DO' and not EX. This issue causes the delivery to split, with one delivery interfacing with WMS and o

  • 9iAS Integration -- processing batches?

    I'm trying to make sense of the 9iAS Integration product based on all the downloadable materials. I understand that the product is essentially message based, but is it possible to use the product to process batches of data? For example, can I use the

  • Plan settlement rules for internal orders

    Hi all,         I am having a problem in setting up plan settlement rules for the internal orders. I have created a order and tried to set up a plan settlement rule. I am trying to settle the order to a Profitability segment PSG category. Everything

  • Adjustment Brush not Working

    in the Develop module my adjustment brush is not working, all the other sliders work, what is wrong?