Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:39:29+00:00 2026-06-05T11:39:29+00:00

This one is a real head scratcher… I have a number of command links

  • 0

This one is a real head scratcher… I have a number of command links which are styled as buttons so in order to enable easy maintenance, I have written a little html fragment that I can include with some parameters to render a nicely styled command link.

Now this works great except when the action outcome is to change view, at which point, the “include” version steadfastly refuses to obey the click to navigate and I have no idea why! If the action results in a validation error, the errors are shown so the action is definitely being called – and my logs confirm this, however, if there are no validation errors, the original version, without using the include, will navigate to the next page just fine, but the version using include will not navigate. I have tried with a very simple “hello.xhtml” page as the second page so I know it can’t be anything to do with the contents of the new view.

Edited for clarity: I use several buttons on the page, most of which just modify the state of the current page and these are all working fine. It’s only when the outcome is to change view that things go wrong with the “include” version.

I’m running JSF 1.2 on top of Portal Server 6.1/WAS 7.0

I’ve spent too long trying to figure this out so over to you guys to see if you have any ideas…

Update: To save wading through the comments, the answer is I was using from-action in my navigation rules, which just matches the string used in the commandLink – so the navigation handler was seeing #{bean[action]} as the from-action rather than #{applicationPage.doContinue}

Some code.

My button template:

<ui:composition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xml:lang="en" lang="en">

    <ui:remove>
        Functional Button with arrow icon.
        Parameters:
        linkId           = The id for the commandLink.
        linkText         = The text to display on the button.
        linkTitle        = title text to display
        bean             = The bean name containing the action handler.
        action           = The action handler to call.
    </ui:remove>
    <div class="btn functionalButton">
        <h:commandLink id="#{linkId}" action="#{bean[action]}" title="#{linkTitle}" styleClass="functional">
                #{linkText}
                <span class="arrow icon" />
            <span class="tl" />
            <span class="tr" />
            <span class="bl" />
            <span class="br" />
        </h:commandLink>
    </div> 

</ui:composition>

And an example of use on a page:

<ui:include src="/WEB-INF/facelets/content/functionalButton.xhtml">
    <ui:param name="linkId" value="applicationSubmit" />
    <ui:param name="bean" value="#{applicationPage}" />
    <ui:param name="action" value="doContinue" />
    <ui:param name="linkText" value="#{msg['button_FF060_continue']} " />
</ui:include>

This version won’t change view.

Prior to using the include, the code looked like this (which should resolve and render to the exact same html) and yet this version changes view just fine.

<div class="btn functionalButton">
    <h:commandLink id="applicationSubmit" styleClass="functional" action="#{applicationPage.doContinue}" title="#{msg['button_FF060_continue']}">
     #{msg['button_FF060_continue']} 
        <span class="arrow icon" id="arrow_continue" />
        <span class="tl" />
        <span class="tr" />
        <span class="bl" />
        <span class="br" />
    </h:commandLink>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:39:30+00:00Added an answer on June 5, 2026 at 11:39 am

    Update: that can happen when the <from-action> in your <navigation-case> associated with the action still references the original EL expression like so:

    <from-action>#{applicationPage.doContinue}</from-action>
    

    It’s not been interpreted as the actual method expression, but as a string literal, exactly the one which you definied in action attribute. So when using an include/tag file, you should change it to the literal EL expression as you used in action attribute:

    <from-action>#{bean[action]}</from-action>
    

    Or maybe better, just remove it. It’s not useful if you don’t have multiple actions which can each possibly return the same outcome but need a different destination. I’d also suggest to use just the <to-view-id> without extension as outcome value. This eases future migration to JSF 2.0 as that would already implicitly be done.


    Original answer below is kept for future reference

    I’m not sure, but probably Facelets 1.x simply doesn’t eat that. This works for Facelets 2.x. I only can’t tell from experience as I’ve never (ab)used an include file this way.

    I’d recommend using it as a tag file instead. Additional benefit is that this also ends up in clearer syntax and the possibility to provide attribute names and descriptions in IDE autocomplete. All you need to do is to create a /META-INF/my.taglib.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE facelet-taglib PUBLIC
        "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
        "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
    
    <facelet-taglib>
        <namespace>http://example.com/jsf/facelets</namespace>
        <tag>
            <tag-name>functionalButton</tag-name>
            <source>/WEB-INF/facelets/content/functionalButton.xhtml</source>
        </tag>
    </facelet-taglib>
    

    (definition of attributes is optional, if you want, add it as <attribute> inside <tag>, I’d also recommend placing those files in some /tags subfolder e.g. /WEB-INF/facelets/tags)

    If you register it in /WEB-INF/web.xml as follows

    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/META-INF/my.taglib.xml</param-value>
    </context-param>
    

    Then you’ll be able to use it as follows:

    xmlns:my="http://example.com/jsf/facelets"
    ...
    <my:functionalButton linkId="applicationSubmit" bean="#{applicationPage}" 
        action="doContinue" linkText="#{msg['button_FF060_continue']} " />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A real head-scrather this one. I have created two ApiControllers which I am using
This one is a real head scratcher for me... var matches = Regex.Matches(<p>test something<script
I have a real world program that is similar to this one, which I'll
This one's a head scratcher. I've created a commented jsFiddle to demonstrate the phenomenon
I'm onto a real head scratcher here ... and it appears to be one
Okay this is a real headscratcher. I have an application which calls a web
This one's got me stumped and it's driving me nuts. I have a SiteFinity
This one is a little tricky. Say I have this XmlDocument <Object> <Property1>1</Property1> <Property2>2</Property2>
This one has me scratching my head, so I'm hoping a second pair of
I ran into a real head scratcher recently while trying to debug an issue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.