H:commandLink navigatioin not working.

I've got the following problem with h:commandLink component.
When I click on the h:commandLink link page is just reloaded and not navigated to the next page.
Here are my configuration files:
web.xml:
<listener>
<listener-class>
com.sun.faces.config.ConfigureListener
</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>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
faces-config.xml
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<navigation-rule>
<from-view-id>/pages/main.html</from-view-id>
<navigation-case>
<from-outcome>incomeCategories</from-outcome>
<to-view-id>/pages/incomecategories.html</to-view-id>
</navigation-case>
</navigation-rule>
And page with this h:commandLink (/pages/main.jsp):
<f:view>
<head>
</head>
<body>
<h:form id="main_form">
<h:commandLink action="incomeCategories" value="Income categories" />
</h:form>
</body>
</f:view>
Should say that there are richfaces and facelet jars in classpath.
And now the results of my investigations:
First, I turned on debug logging, learned log file and found out that there is nothig about processing navigation rules in it.
Second, I tried to call some bean's method in h:commandLink action, but got an exception that method not found. It's exactly that bean was described with no mistakes and method had valid signature. But for unknown reason its not found.
I've been working on this issue for two days but unsuccessfully. Very strange....
Does anybody have any ideas? Thanks in advance.

The problem was as stupid as strange !!!
It turned out, that while building war file I've forgotten to put faces-context.xml file in it. That's why the configuration I described was not applied to application!

Similar Messages

  • Help: commandLink does not work.

    commandLink does not work. It just simple refreshes the page, and not enter the Listener,( he listener work pretty well in other page).
    Is it dataTable problem? If I not use dataTable but just use JSTL & JSF commandLink and it works fine.
    --------------CODE---------------
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <link rel="stylesheet" type="text/css" href='<%= request.getContextPath() + "/style/styletable.css"%>'/>
    <f:loadBundle basename="bundle.admin.Attribute" var="bdlAttribute"/>
    <f:subview id="AttributeListView">
    <h:form id="AttributeListForm">
    <center>
    <h:outputText escape="false" value="Text Here"/>
    <br>
    <h:dataTable id="AttributeTable"
    columnClasses="list-column-center,list-column-right, list-column-center, list-column-right"
    headerClass="list-header"
    rowClasses="list-row"
    styleClass="list-background"
    value="#{list}"
    var="attribute">
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.TitleList}"/>
    </f:facet>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Category}"/>
    </f:facet>
    <h:outputText id="category" value="#{attribute.category}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Value}"/>
    </f:facet>
    <h:outputText id="value"
    value="#{attribute.value}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.DataType}"/>
    </f:facet>
    <h:outputText id="dataType" value="#{attribute.dataType}">
    </h:outputText>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Edit}" />
    </f:facet>
              <h:commandLink action="#{Action.action}" styleClass="link">
                   <f:actionListener type="my.AttributeListener"/>
                   <h:outputText value="Edit"/>
                   <f:param name="ID" value="#{attribute.attributeId}"/>
                   <f:attribute name="COMMAND" value="getAttribute"/>
              </h:commandLink>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Delete}"/>
    </f:facet>
         <h:commandLink action="#{Action.action}" styleClass="link">
              <f:actionListener type="my.AttributeListener"/>
              <h:outputText value="Delete"/>
              <f:param name="ID" value="#{attribute.attributeId}"/>
              <f:attribute name="COMMAND" value="deleteAttribute"/>
         </h:commandLink>
    </h:column>
    </h:dataTable>
    <h:messages styleClass="validationMessage"/>
    </center>
    </h:form>
    </f:subview>

    Hi,
    I was casually reading your code and noticed the line:'
    <h:commandLink action="#{Action.action}" styleClass="link">
    I recall from other posts that if you want the method on the bean (of the clicked/ selected row) to be called, you probably need:
    <h:commandLink action="#{attribute.action}" styleClass="link">
    Ofcourse you would need to have a method called action in the class of instance "attribute". This method should return string for navigation etc.
    Looking at your code again:
    <h:commandLink action="#{Action.action}" styleClass="link">
    <f:actionListener type="my.AttributeListener"/>
    <h:outputText value="Delete"/>
    <f:param name="ID" value="#{attribute.attributeId}"/>
    <f:attribute name="COMMAND" value="deleteAttribute"/>
    </h:commandLink>
    I don't understand why you need:
    <f:actionListener type="my.AttributeListener"/>
    As I am not coding a lot of JSF I am only answering from what I have read.
    All the best,
    Vinay

  • JSF : Dynamic link generated by commandLink does not work

    In the following code, without <f:verbatim>, it is giving "Duplicate ID in the view" Exception. But with <f:verbatim>, the links generated by commandLink does not work. Please help me to solve this problem.
    Thank you in advance.
    Regards
    Abdul
    <%-- jsf:pagecode language="java" location="/src/pagecode/eservice/DisplayMoreEServices.java" --%><%-- /jsf:pagecode --%>
    <%@ include file="/includes/g_common_include.jsp" %>
    <%@page import="java.util.Map"%>
    <%@page import="bh.com.cio.egov.EGOVConstants"%>
    <%@page import="javax.portlet.PortletSession"%>
    <%@page language="java"%>
    <%
         PortletSession ses = renderRequest.getPortletSession();
         Map eServiceCatMap = (Map) ses.getAttribute(EGOVConstants.REQ_ESERVICE_LIST_BY_CAT);
         renderRequest.setAttribute(EGOVConstants.REQ_ESERVICE_LIST_BY_CAT,eServiceCatMap);
    %>
    <%@page import="bh.com.cio.egov.vo.EServiceVO"%>
    <f:view>
         <script type="text/javascript">          
              function blinkThis(id, color, timeout)
                   var idElem = document.getElementById(id);
                   if(idElem)
                        idElem.getElementsByTagName('span')[0].style.color = color;
                        setTimeout('switchColor(\'' + id + '\', \'#8A7C5B\', ' + timeout + ')', timeout);
              function switchColor(id, color, timeout)
                   var idElem = document.getElementById(id);
                   if(idElem)
                        idElem.getElementsByTagName('span')[0].style.color = color;
                        setTimeout('blinkThis(\'' + id + '\', \'#FF3030\', ' + timeout + ')', timeout);
         </script>
    <f:loadBundle basename="nls.egovresource" var="nls"/>
    <hx:scriptCollector id="scriptCollector1">
         <h:form id="form2">     
    <f:verbatim>
              <div class="header-top">
                   <h:outputText value='#{nls["eservice_label_title"]}'></h:outputText>
              </div>
              <c:forEach items="${requestScope.REQ_ESERVICE_LIST_BY_CAT}" var="categoryVOs" varStatus="catIndex">
                   <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                             <td> </td>
                             <td class="gray1" height="30px">
                                       <c:out value="${categoryVOs.value.category.categoryName}" escapeXml="false"></c:out>
                             </td>                
                        </tr>
                        <tr>
                             <td width="2">
                                  <div align="right">           
                                       <img src='<%= imageRootDir + "dot.png"%>' width="4" height="1" />
                                  </div>
                             </td>
                             <td width="100%" >
                                  <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                                       <c:forEach items="${categoryVOs.value.eservice}" var="service" varStatus="serviceIndex">
                                       <%
                                            EServiceVO serviceObj = (EServiceVO) pageContext.getAttribute("service");
                                            String action = null;
                                            int serviceId= -1;
                                            if(serviceObj!=null)
                                                 action = serviceObj.getServiceAction();
                                                 serviceId = serviceObj.getServiceId();
                                            if(action!=null && action.startsWith("$"))
                                       %>
                                       <c:set var="jstl_to_jsf_serviceName" value="${service.serviceName}" scope="request"/>
                                       <c:set var="jstl_to_jsf_url_en" value="${service.serviceAction}" scope="request"/>
                                       <c:set var="jstl_to_jsf_url_ar" value="${service.serviceActionAr}" scope="request"/>
                                       <tr>
                                            <td height="17">                         
                                                 <table width="100%" border="0" cellspacing="0" cellpadding="0">                              
                                                      <tr>
                                                           <td width="95%" id="extMoreCell_${catIndex.index}_${serviceIndex.index}">                                                                      
                                                                <img src='<%= imageRootDir +"arrow1.png"%>' width="15" height="16" border="0"/>
                                                                <h:commandLink styleClass="links menu-txt" action="#{pc_EServiceView.doExternalLinkAction}">
                                            <h:outputText value="#{jstl_to_jsf_serviceName}" styleClass="menu-txt"/>
                                                 <f:param name="PARAM_ESERVICE_URL_EN" value="#{jstl_to_jsf_url_en}"></f:param>
                                                 <f:param name="PARAM_ESERVICE_URL_AR" value="#{jstl_to_jsf_url_ar}"></f:param>
                                                 <f:param name="JSP_ACTION" value="ACT_EXTERNAL_ESERVICE"></f:param>
                                            </h:commandLink>
                                                           </td>
                                                      </tr>                                             
                                                 </table>
                                                 <script type="text/javascript">
                                                      <c:if test="${service.serviceId eq '53'}">
                                                           blinkThis('extMoreCell_7_3', '#FF3030', 1000);
                                                      </c:if>                                        
                                                      <c:if test="${service.serviceId eq '54'}">
                                                           blinkThis('extMoreCell_7_4', '#FF3030', 1000);
                                                      </c:if>     
                                                      <c:if test="${service.serviceId eq '55'}">
                                                           blinkThis('extMoreCell_7_5', '#FF3030', 1000);
                                                      </c:if>          
                                                      <c:if test="${service.serviceId eq '56'}">
                                                           blinkThis('extMoreCell_0_8', '#FF3030', 1000);
                                                      </c:if>     
                                                      <c:if test="${service.serviceId eq '57'}">
                                                           blinkThis('extMoreCell_8_8', '#FF3030', 1000);
                                                      </c:if>     
                                                      <c:if test="${service.serviceId eq '59'}">
                                                           blinkThis('extMoreCell_1_8', '#FF3030', 1000);
                                                      </c:if>     
                                                      <c:if test="${service.serviceId eq '58'}">
                                                           blinkThis('extMoreCell_5_6', '#FF3030', 1000);
                                                      </c:if>     
                                                           <c:if test="${service.serviceId eq '28'}">
                                                           blinkThis('extMoreCell_1_4', '#FF3030', 1000);
                                                      </c:if>     
                                                           <c:if test="${service.serviceId eq '20'}">
                                                           blinkThis('extMoreCell_5_3', '#FF3030', 1000);
                                                      </c:if>     
                                                           <c:if test="${service.serviceId eq '60'}">
                                                           blinkThis('extMoreCell_7_6', '#FF3030', 1000);
                                                      </c:if>     
                                                 </script>
                                            </td>
                                       </tr>
                                       <tr>
                                            <td bgcolor="#FAF9FA" background='<%= imageRootDir + "line-bg-eservices.png"%>'><img src='<%= imageRootDir +"line-bg-eservices.png"%>' width="2" height="1" border="0"/></td>
                                       </tr>     
                                       <%}
                                       else if(action!=null)
                                       %>                                                                                               
                                       <c:set var="jstl_to_jsf_serviceName" value="${service.serviceName}" scope="request"/>
                                       <wps:urlGeneration contentNode="${service.serviceAction}" allowRelativeURL="false" keepNavigationalState="true">
                                       <%
                                       //String urlC = "http://"+renderRequest.getServerName()+":"+renderRequest.getServerPort()+wpsURL;
                                       String urlC = "" + wpsURL;
                                       %>
                                       <c:set var="url" value="<%=urlC%>" scope="request"/>
                                  </wps:urlGeneration>
                                       <tr>
                                            <td height="17">                         
                                                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                      <tr>
                                                           <td id="intMoreCell_${catIndex.index}_${serviceIndex.index}">
                                                           <img src='<%= imageRootDir +"arrow1.png"%>' width="15" height="16" border="0"/>     
                                                           <hx:outputLinkEx styleClass="links menu-txt" value="#{url}">
                                                                <h:outputText value="#{jstl_to_jsf_serviceName}" styleClass="menu-txt"></h:outputText>
                                                           </hx:outputLinkEx>
                                                           </td>
                                                      </tr>                                                                                                                             
                                                 </table>
                                            </td>
                                       </tr>
                                       <tr>
                                            <td bgcolor="#FAF9FA" background='<%= imageRootDir + "line-bg-eservices.png"%>' ><img src='<%= imageRootDir +"line-bg-eservices.png"%>' width="2" height="1" border="0"/></td>
                                       </tr>     
                                       <%
                                            %>               
                                       </c:forEach>                                             
                                  </table>
                             </td>
                        </tr>
                   </table>                                                                                                                                                                     
              </c:forEach>
              </br>
              <h:messages styleClass="messages" id="messages1"></h:messages>
              </f:verbatim>     
              </h:form>
         </hx:scriptCollector>
    </f:view>

    1) Throw your code away and use h:dataTable instead of c:forEach to render a table of dynamic size.
    or:
    2) Hand-assign every UIInput and UICommand element inside the loop an unique ID. E.g. "commandLinkId" + loopIndex

  • H:commandLink does not work on Safari

    Hi,
    I'm using JBoss AS 4.2.2.GA with Seam 2.0.1.GA and all its standard libs. But this seems to be a JSF-RI issue which is used by JBoss 4.2.2.GA
    It seems as if <h:commandLink> don't work on Safari 3/Mac OS Leopard, which they did in earlier prjects with jboss 4.0.5.GA and Seam 1.2.1.GA. In this version myfaces was used.
    The commandLink in the following example produces a JavaScript error "Undefined value". It doesn't matter if the action or the form is empty. I've simplified the example but this also happens with a "complete" form.
    The starange thing is that if I copy the generated HTML source into an html file, open that file and click the "command" link, it works (however an error page is shown since this is not a legal Seam request).
    I've no idea why this browser makes a difference between these two files since I have used <h:commandLink> in many earlier projects with earlier versions of the components. Firefox works without a problem.
    I've already changed the extension of JSF/Seam from .seam to .html. Same error.
    Anyone can help here?
    Alex
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">
    <head>   
    </head>
    <body>
    <f:view>
         <h:form id="aForm">
              <h:commandLink id="theId" >abc</h:commandLink>
         </h:form>
    </f:view>
    </body>
    </html>This is the generated HTML. The JavaScript error points to the line with the link.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>   
    </head>
    <body>
    <form id="aForm" name="aForm" method="post" action="/leadspot/test.seam" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="aForm" value="aForm" />
    <script type="text/javascript" language="Javascript">
    //<![CDATA[
    function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp
    );}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var ps = pvp.split(',');for (var i = 0
    ,ii = 0;i < ps.length;i++,ii++) {var p = document.createElement("input");p.type = "hidden";p.name = ps
    ;p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp, t) {apf(f, pvp)
    ;var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};
    //]]>
    </script>
    <a id="aForm:theId" href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['aForm'],'aForm:theId,aForm:theId','');}retu
    rn false">abc</a><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="_id7" />
    </form>
    </body>
    </html>

    alxsde wrote:
    What I still don't understand is why the same HTML code works when loaded from a file and is not generated by JSF.Hi. I committed the fix. For what it's worth, I hand-coded the JS in a static file for testing and was able to reproduce the problem and test the fix there before altering the Mojarra code. Why are you seeing different behavior? * shrug * :P
    Glad it got you going though. :)

  • H:commandLink is not working in Firefox broweser

    We are developing an application in seam frame work for that jsf is used for front end design.. In our application one of the jsf page want to submit the page through javascript for i definded an jsf and java script are like
    In jsf page
    <form id="submitform">
    <h:commandLink id="link" action="url" />
    </form>
    java script
    document.getElementById('submitform:link').click();
    it was working fine in IE but in Firefox(2.0.9) it not working .....please give an some suggestion..
    Thanks in Advance
    Mohan

    Use onclick() instead. The click() only works for buttons.

  • Urgent -Help needed : a4j:CommandLink  'reRender ' not working.

    Hi,
    I am using <a4j:commandLink for my application to get the ajax functinality.
    Here i am rerendering a data table with the id -commentsId
    here is the Synatax, we dont have any clue to how do we progress on this.
    <a4j:commandLink value="submit1" reRender="commentsId" >
    <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender" />
    </a4j:commandLink>
    Please help me.
    Thanks in advance.
    -Arthi.

    I had this problem 1 year ago, when check the keyboard cable see that all was correct...then
    Buy a new one, and now the keyboard works; maybe anybody throw water in the keyboard; please check first with a usb keyboard.

  • CommandLink doesn't work with rendered-attribute

    Hello,
    I have quite a strange problem.
    I have a commanLink, which has a rendered attribute. The link is rendered conditionally, so the rendered-value comes from a bean.
    <h:commandLink rendered="#{Bean.canEdit}" action="#{Bean.selectDocumentToEdit}" >
               <h:outputText value="Edit doc" />
                              <f:param name="param" value="#{Bean.doc.id}"/>
    </h:commandLink>Showing the link is working like it should, but commandLink is not working with this. When I change rendered="true", commandLink works ok. But now it doesn't call the commandLink action at all.
    Any help would be appreciated

    rendered="true", commandLink works ok. But now it
    doesn't call the commandLink action at all.I meant it doesn't call the commandLink action method when retrieving rendered-value from bean.
    I'm using RI 1.1.01

  • CommandLinks and CommandButtons in Datatable do not work

    I have read the threads about this issue and am aware of the fact that there is a problem, if the backing bean is in request scope. However, my backing bean is in session scope and it still does not work - my action methods are never called. What's more, I have another backing bean in session scope, where it works perfectly and I cannot see any difference between them.
    Here's the code, my backing bean is dms:
    <h:form rendered="#{dms.documents.rowCount > 0}">
    <h:dataTable rowClasses="..." headerClass="..." value="#{dms.documents}"
    columnClasses="..." var="item" border="1" cellpadding="2" cellspacing="0">
    <h:column>
    <f:facet name="header">
    <h:outputText>DocName</h:outputText>
    </f:facet>
    <h:commandLink action="#{dms.test}" value="#{item.docName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"/>
    <h:commandButton id="foo" value="View" action="#{dms.test}"/>
    </h:column>
    </h:dataTable>
    <h:commandLink action="#{dms.test}" value="Clickme"/>
    </h:form>
    Here is the code in the backing bean:
    public String test() {
    System.out.println("Hooray");
    return "mainPage";
    And this in faces-config.xml:
    <managed-bean>
    <managed-bean-name>dms</managed-bean-name>
    <managed-bean-class>com.mypackage.DmsController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    Only the last link, the one outside the datatable and titled "Clickme", works. I can see "Hooray" in the logfile and am redirected to the main page. If I click any of the links or buttons in the datatable, nothing is written to the log and the same page is loaded again, but only the static content is displayed, i.e. no JSF tags are evaluated, they are just dropped. There are, however, a few hidden input fields called javax.faces.ViewState, which I don't know where they are coming from.
    As I said, I have another backing bean in session scope, which is modelled exactly like that and it works there. Maybe JSF apps are supposed to have only one controller?
    Many thanks in advance for any pointers,
    Ulrich
    Edit: It doesn't change anything if I put the backing bean in application scope. I did have the same problem before with my other backing bean, but could solve it there by putting it from request scope to session scope.

    <h:dataTable value="#{dms.documents}">How do you load this list? This list should not be null during the INVOKE_APPLICATION phase.
    Try stubbing the List right in the getDocuments() method and see if it works.

  • Af:commandLink : hover & active CSS not working

    Hi ,
    I am using JDeveloper 11.1.1.6
    My scenario is need to change the color in <af:commandLink> at that time of active.I tried the below CSS styles ,
    +af|commandLink :active{+
    background-color: #7FFFD4;
    +}+
    +af|commandLink :hover{+
    background-color: #FFCCFF;
    +}+
    But it's not working .I followed this http://jdevadf.oracle.com/adf-richclient-demo/faces/components/skinningKeys/commandLink.jspx URL .

    Hi Lait,
    Thanks for the replay.
    I tried with hover it's working fine but still selected and activate properties are not working .I am using below Style & I am testing in IE 8.
    af|commandLink
    +{+
    color: Lime;
    +}+
    af|commandLink:active
    +{+
    color: Gray;
    +}+
    af|commandLink:hover
    +{+
    color: Red;
    +}+
    af|commandLink:visited
    +{+
    color: White;
    +}+
    af|commandLink :selected
    +{+
    color: Yellow;
    +}+
    Thanks ,
    David.

  • Af:commandLink : selected & visited CSS not working

    Hi All ,
    I am using JDeveloper 11.1.1.6.
    My Scenario is after click the Command links the link color need to be changed .
    hover property in command link is working fine but selected and visited are not working.
    I tried below CSS,
    [code]
    af|commandLink:hover {
        background-color: Red;
    af|commandLink:selected {
        background-color: Green;
    af|commandLink:visited {
        background-color: Blue;
    [/code]
    Thanks ,
    Arun D.

    Hi Arun,
    If i am note getting you wrong, then you mean to say that the color is changing when you have clicked and not yet left the mouse button (the Mouse button is still clicked)
    Then u have to add the pseudo class "commandLink:active :hover"
    Thanks,
    Pandu

  • H:commandLink not working all the times

    Hi,
    I am working on an application, with JSF and Spring. In the application I have one page containing a h:dataTable containing records from database. The first column in the dataTable is a commandLink on click of which I need to call method frmo managedBean defined in the action tag.
    The problem regarding the above scenario is that the commandLink is workign alternate times, like when the page loads first the commandLink will work fine calling the action method in the managedBean but when I click the same link second time it does not call the method in managedBean, then third time it works again fine. My managed Bean is in session scope.
    I need to open the details of the link in a new window which will be opened using target="_blank".
    Can anybody please help me regarding the above scenario and giving me any solution why the hypelink is behaving like this.
    Thnak You in advance.
    Edited by: rBond008 on Aug 21, 2009 1:51 AM

    i am facing the same problem.
    I have a view in session scope and which opens in multiple pages on clicking <h:commandLink target="_blank">
    in a datatable.
    The thing is page is opening fine for the alternate clicks and all command links in parent page are not functioning properly.
    They are working properly at alternate clicks.
    I found the problem from debug logs as the form is not getting submitted on alternate clicks which is making the framework to quit the "*INVOKE_APPLICATION*" phase.
    i tried using onclick="javascript:submit()" as part of each command link but it is not working fine all the time.

  • One reason why commandLink doesn't work in dataTable

    Ok, so I think I've got an explanation why commandLink doesn't work in dataTable when the model bean is request scoped. Maybe somebody can tell me if I'm wrong.
    I have a model bean that generates table rows based on some input criteria (request parameters).
    So, we validate the inputs, apply them to the bean and render the page. Once the inputs have been applied to the bean, a request for table rows returns rows, no problem.
    However, we put a commandLink in each row, so we can expand the details. Maybe we even get smart and repeat the input row-generating criteria as a hidden field in the page.
    Unfortunately, when the user hits the commandLink, the list page simply refreshes, maybe even w/out table rows. The user doesn't get the details page as expected.
    Why not?
    Because: in the DECODE phase (even before validation and before "immediate" values have had their valueChangeListeners called), we ask the model bean for the table rows, so we can decode the commandLinks. Unfortunately, in "decode" phase, the request-scoped model bean has not had its row-generating criteria updated (that happens in the "update model" normally, or at the END of the decode phase if we got cute by (1) setting the "immediate" attribute on the row-generating criteria to "true" AND (2) set a valueChangeListener to allow us to update the model bean early. The END of the decode phase isn't good enough -- in the middle of that phase, when we're attempting to deocde commandLinks, the model bean has no citeria, so there's no row data. No row data means no iteration over commandLinks to decode them and queue ActionEvents. So, we march through the rest of the phases, process no events, and return to the screen of origin (the list screen) with no errors.
    So, what's the solution?
    One solution is to make the model bean session-scoped. Fine, maybe we can store a tiny bit of data in it (the search criteria), so it's not such a memory drag to have it live in the session forever. How do we get that data in? A managed property in faces-config.xml with value #{param.PARENT_KEY} won't work because it's assigning request-scoped data to a session-scoped holder. JBoss balks, and rightly so. Do we write code in the model bean that pulls the request parameter out of thin air? (FacesContext.getExternalContext()....) I don't really like to code the name of a specific http request parameter into the bean, I think it's the job of the JSP or faces-config.xml to achieve that binding (request parameter to model propery). Plus, I'd be sad to introduce a dependency on Faces in what was previously just a bean.
    Is there a better way?
    In my particular situation, we're grafting some Faces pages onto an already-existing non-Faces application. I don't get the luxury of presenting the user an input field and binding it to a bean. All I've got to work with is a request parameter.
    Hmm, I guess I just answered my own question. if all I've got to work with is a request parameter, some ugliness is inevitable, I guess.
    I guess the best fix is to cheat and have the bean constructor look for a request parameter. If it finds it, it initializes the criteria field (which, in my case, is the key of an object that has a bunch of associated objects (the rows data), but could be more-general d/b search criteria).
    (I looked at the "repeater" example code in the RI, but it basically statically-generates its data and then uses 100% Faces (of course) to manage the paging (where "page number" is essentially the "criteria").
    Comments? Did I miss something obvious?
    John.

    ...or I could just break down and do the thing I was hoping to avoid (outputLink instead of commandLink):
    <h:outputLink value="/faces/Detail.jsp">
      <f:param name="PARENT_KEY" value="#{bean.parentKey}"/>
      <h:outputText value="#{bean.label}"/>
    </h:outputLink>It's still a "hardcoded" parameter name, but at least the binding is in the JSP and faces-config.xml, not the bean Java code.

  • Command link in adf table is not working..

    Hi All,
    I am having ADF Table, in that one column is with command link and,if click on commnad link it is not going to coorsponding action or actionListener methods of bean. If i give same command link out side of the table it working fine.But i have to pass some perameters on click of button.
    I am getting same problem in many places , if i delete the page and page-def files again if i create some times it is working but some times not working. Is there any specific reason for this.Following is the code snippet...
    <af:column sortProperty="GlobalDealId" sortable="false"
    headerText="#{bindings.DsaDealsResultsVO1.hints.GlobalDealId.label}"
    id="c8">
    <af:commandLink text="#{row.GlobalDealId}" id="cl1" action="#{pageFlowScope.editProfileCompleteness.sample}" immediate="true" partialSubmit="true">
    <af:setActionListener from='"#{row.GlobalDealId}"'
    to='"#{pageFlowScope.globalDealId}"'/>
    <af:setActionListener from='"#{row.CustName}"'
    to='"#{pageFlowScope.custName}"'/>
    <af:setActionListener from='"#{row.IsSaDeal}"'
    to='"#{pageFlowScope.isSaDeal}"'/>
    </af:commandLink>
    </af:column>
    Even i tried with out immediate="true" partialSubmit="true" also.
    And i set ChangeventPolicy = ppr for Iterator in page defnation file.
    Awaiting for ur reply.

    Hi,
    the real problem of the original poster seems to be <af:commandLink text="#{row.GlobalDealId}" id="cl1" action="createMDM" immediate="true" partialSubmit="true"> having immediate set to true in which case the request goes from restore view to render response. You usually use immediate=true on a command item to cancel an action (bypassing all the other JSF lifecycle steps).
    Peter551059,
    you don't give us much information about your case. So if the problem is IE9 and you verified IE9 is supported for the version of JDeveloper you use, then - in case you have a support contract - my best advise is to file a service request and have support looking at it just in case you hit a defect that should be filed as a bug
    Frank

  • af:commandLink does not prompt download File Dialog Not available

    I am using following code for downloading pdf file
    <*af:commandLink* text="#{row.docContentID}" id="cl31"
    immediate="true" partialSubmit="true">
    <af:fileDownloadActionListener contentType="application/pdf"
    method="#{pageFlowScope.BulletinsBean.getDocument}"
    filename="#{row.docContentID}.pdf"/>
    </af:commandLink>
    where i written code in getDocument() method of bean
    where i have written file in outputstream which comes from input stream as follows:
    InputStream stream = null;
    int reportedSize = Integer.parseInt (response.getHeader ("Content-Length"));
    //String contentsInHex = "";
    //-------------------Write to browser---------------------
    // Prepare.
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext = facesContext.getExternalContext();
    HttpServletResponse responseHttp = (HttpServletResponse) externalContext.getResponse();
    // Initialize response.
    responseHttp.reset();
    responseHttp.setContentType("application/x-pdf");
    responseHttp.addHeader("Content-Disposition", "attachment ; filename="+contentId +".pdf");
    responseHttp.setContentLength( reportedSize);
    OutputStream output = responseHttp.getOutputStream();
    try
    stream = response.getResponseStream ();
    buf= new byte[100];
    int numRead;
    while ( (numRead = stream.read(buf) ) >= 0) {
    output.write(buf, 0, numRead);
    facesContext.responseComplete();
    output.close();
    If i am using simple *<h:commandLink>* then it works fine but i am not able to get the text of that link to my action method . In this case i get all the table links text .
    There are many links on the table.
    But at the time of using af:commandlink i am not able to get the download dialog promp in firefox it gets directly downloaded and in case of IE8 it gives me bar upperside for getting download (This is blocked for security resons and when i click there is option for download)

    ok Thank you but what about <h:commandLink>
    When i Select on of the <h:commandlink> it gives me list of all commandlinks values in the table
    Will you please guide me.I used following code for getting link i get selected
    public String getPdfDocument()throws IOException {
    String Value = null;
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{row.docContentID}", Object.class);
    //System.out.println("Selected Value---"+valueExp.getValue(elContext));
    if(valueExp.getValue(elContext) !=null) {
    Value = valueExp.getValue(elContext).toString();
    DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iter =
    (DCIteratorBinding)bindings.findIteratorBinding("ListOfDocumentsIterator");
    Row row=iter.getCurrentRow();
    Value= row.getAttribute("docContentID").toString();//JSFUtils.resolveExpression("#{row.docContentID}").toString();
    System.out.println("Selected Value is---"+Value);
    return null;
    }

  • FIle download not working in page fragment

    Hi All,
    I have to download a file . I am using Dynamic tab shell and in one pf my page fragement link to download a file is avaliable...
    I did a POC on jspx and its working fine but when i try to use the same code in my jsff (page frament ) its not working any idea that do i have to do anything specific to acheive the same..
    Thanks
    Shubhangi

    Shubhangi/Timo,
    was this resolved? I am having the same issue. File download works fine in a jspx page but the same code is not working when file download is used as part of a page fragment.
    I have a table column that has the filename as commandlink with a managed bean code as below.
    public oracle.binding.BindingContainer getBindings() {
    return BindingContext.getCurrent().getCurrentBindingsEntry();
    public void downloadFile(ActionEvent actionEvent) {
    FacesContext fctx = FacesContext.getCurrentInstance();
    // myDocumentLocation specified in web.xml
    String DOCUMENTS_LOCATION =
    fctx.getExternalContext().getInitParameter("myDocumentLocation");
    if (DOCUMENTS_LOCATION == null) {
    // DOCUMENTS_LOCATION = "C:\\Documents and Settings\\xxloc\\";
    Application app = fctx.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = fctx.getELContext();
    ValueExpression valueExp =
    elFactory.createValueExpression(elContext, "#{row.OrderFileName}",
    Object.class);
    String s1 = (String)valueExp.getValue(elContext);
    System.out.println(s1);
    String filename = s1 ;
    File srcdoc =
    new File(DOCUMENTS_LOCATION + filename);
    if (srcdoc.exists()) {
    FileInputStream fis;
    System.out.println("exists");
    byte[] b;
    HttpServletResponse response =
    (HttpServletResponse)fctx.getExternalContext().getResponse();
    response.setContentType("application/x-download");
    response.setHeader("Content-Disposition",
    "attachment; filename=" + filename);
    response.setBufferSize(1024);
    // response.setContentLength((new Long(srcdoc.length())).intValue());
    OutputStream out = null;
    try {
    out = response.getOutputStream();
    } catch (IOException e) {
    e.printStackTrace();
    try {
    fis = new FileInputStream(srcdoc);
    int n;
    n = fis.available();
    while (n > 0) {
    b = new byte[n];
    System.out.println("b" +b);
    int result = fis.read(b);
    out.write(b, 0, b.length);
    if (result == -1)
    break;
    } catch (IOException e) {
    System.out.println("in file error");
    e.printStackTrace();
    try {
    out.flush();
    out.close();
    } catch (IOException e) {
    e.printStackTrace();
    fctx.responseComplete();
    It would be great if someone could guide me with this issue.
    Thanks,
    RAS

Maybe you are looking for