Command_link

I''ve noticed that, if you have a page that contains form and an input_text tag with the parameter required="true", for example:
<h:input_text size="20" value="#{SRAddCc.cab}" required="true">
     <f:validate_length minimum="4" maximum="6"/>
</h:input_text>
<h:messages for="SRCab" styleClass="testo_menu"/>     
<h:panel_group/>
<h:command_button value="#{bundle.Insert}" action="#{Actions.addCc}" />
the command_link that is referred to another action but in the same page for example:
<h:panel_grid width="210" columns="2" columnClasses="box195,box15" bgcolor="#C0C0FF">                    
<h:command_link action="#{Actions.riclassificazione}" styleClass="tip"><h:output_text value="#{bundle.Ana}"/></h:command_link>
<h:graphic_image url="images/pallino2.gif"/>
</h:panel_grid>     
is not resolved because the validation is not satisfied when I click the link.
TO UNDERSTAND BETTER:
Actions.addCc return success
Actions.riclassificazione return riclassifica
and the faces-config.xml is:
     <navigation-rule>
          <from-view-id>/SR_add_cc.jsp</from-view-id>
          <navigation-case>
               <from-outcome>success</from-outcome>
               <to-view-id>/main.jsp</to-view-id>
          </navigation-case>     
          <navigation-case>
               <from-outcome>riclassifica</from-outcome>
               <to-view-id>/RI_ce.jsf</to-view-id>                    
          </navigation-case>          
     </navigation-rule>     
Thank's for your attention
Matteo

I've tried with immediate="true" but it doesn't work, if I cut off required="true" the navigation rule starts to work well again.
Thanks the same one in order to have made to discover to me the immediate parameter
Matteo

Similar Messages

  • Command_link generated by JSTL does not return value attribute

    Since data_table CANNOT RENDER DATA IN SINGLE ROW, MULTIPLE COLUMNS, I am using the following to show the data as links in single row, multiple columns
    <TABLE><TR><TD>
    <c:forEach var="item" items="${MyBean.Filters}">
    <c:set var="myLink" value="${item}" scope="request"/>
    <h:command_link value="#{myLink}" actionListener="#{MyBean.LinkSelected}">
    <h:output_text value="#{myLink}"/>
    </h:command_link>
    </c:forEach>
    </TD></TR></TABLE>
    The above JSTL shows up the links fine in a single row. But when a link is selected and the actionlistener is called, I see that the value parameter is null. Is this because the command_link is in a TABLE (i think I read somewhere that this is a known bug... )
    I do
    value = (String)((UICommand) event.getSource()).getValue();
    to get the value...
    I tried several ways.. all I need is a way to distinguish the links and know which link has been selected.
    Any suggestions please....

    The value is null when the ActionEvent listener fires, because the myLink variable is only available during processing of the JSP page as part of the Render Response phase, not in the request triggered by clicking on the generated link.
    There's simply no way to get this to work using JSTL's <c:forEach> action, and it's not because we didn't try. A custom renderer for the UIData component that renders a single component as a table with one row with multiple columns (or whatever you need) is the only solution I can think of.
    Hans Bergsten (EG member)

  • Command_link help

    Hello
    I am using JSF 1.0 and I can not get a command_link to work
    the follwing code
    <h:command_link action="IncidentBeanUtil.reasonaction" value = "Next>>"/>
    generates the follwing error
    jasper.JasperException: /mainPage.jsp(179,3) No tag "command_link" defined in tag library imported with prefix "h"
    I was using a command button but I need a command link so that I can pass parameter to action
    menthod
    What am I doing wrong.

    it's commanLink now, read the latest docs at:
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

  • Command_link bug in JSF 1.1

    When I click some hyperlink, (generated by Command_link component), It pops out a javascript error message, indicates that field *:idcl is null or null object, namely the field *:idcl is missing.
    I have a close look at html code, I found that most Command_link generate a hidden field name *:idcl, but some of them not. However, all Command_link generate a javascript onclick event: *[*:idcl ].value = *.value. it gets error here!

    Can you please provide your jsp page, and any other information (faces-config.xml, managed beans, etc...)?
    It will help us isolate the probem.
    Thanks, Roger (EG member)

  • Command_link questions

    Hi
    i am totaly new to JSF and have problems using the command_link tags. I'd like to have multiple links to select different values for one property of a managed bean. I tried to achive this by using follwing code snipset
    <h:command_link action="edit">
        <h:output_text value="user 1" />
        <c:parameter value="1" bindg="#{editUser.userUid}"/>
    </hl:command_link><br>
    <hl:command_link action="edit" >
        <h:output_text value="user 2" />
        <c:parameter value="2" bindg="#{editUser.userUid}"/>
    </h:command_link><br>
    <h:command_link action="edit" >
        <h:output_text value="user 3" />
        <c:parameter value="3" bindg="#{editUser.userUid}"/>
    </h:command_link><br>does anybody knwo how to solve this problem?
    thx
    Markus J.

    <c:parameter value="1" bindg="#{editUser.userUid}"/>
    paramater tag is part of HTML tag library, so it should h:parameter. Also this tag takes a "name" and "value" atributes and ofcourse "value" can be a JSF EL expression. hope this helps.
    -Jayashri

  • Command_link page navigation and acoinListener

    I have a command link inside a form that includes a table, my page navigatoin does not work though.
    when i clik on the link i am still in the same page. the actionListener is not called either. It seems like a pretty basic thing. but I can not get it to work.
    when I view the html code generated the <form> action attribute is still set to the same page. regardless of the value of the action attribute for <h:command_link>
    here is portion of the jsp file
    <h:form>
    <h:data_table>
    <h:column>
    <f:facet name="header">
    <h:output_text value="Name"/>
    </f:facet>
    <h:command_link id="PartnerName" action="#{Partners.success}" immediate="true" actionListener=" #{Partners.handlePartner}">
    <h:output_text value="#{item.partnerName}"/>
    </h:command_link>
    <h:data_table>
    </h:form>
    here is a code snippet from the backing bean Partners
    public String success()
    return "success";
    public void handlePartner(ActionEvent event)
    System.out.println("in partner action listener!!");
    Here is my navigation rule:
    <navigation-rule>
         <from-view-id>partners.jsp</from-view-id>
         <navigation-case>
              <from-outcome>success</from-outcome>
              <to-view-id>newpartner.jsp</to-view-id>
         </navigation-case>
    </navigation-rule>
    Any help is really really appreciated.
    thanks
    --Omid

    thanks for the replay...
    you know what? i had my bean-scopse set to request. that was the source of the problem. I changed it to
    session and now it is working. This sounds like a bug. doesn't it?
    thanx
    --Omid                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Command_link does not work outside of form

    if command_link is outside of form, it is rendered without a warning notes, but does not work correctly.

    Sorry, you did not get my point again.
    Currently, I check how JSF RI helps developer to recognize his/her mistakes.
    In case of command_link outside of the form, RI says "Everything is all right. Spend the next couple minutes (couple hours or days, depends of developer qualification) to find this trick.

  • Command_link rendered value binding causes NullPointerException

    command_link is put in a data_table. Intiailly, data_table has no rows. The command_link's render attribute is binded to a property of a row bean. e.g.
    <h:data_table id="resourcesTable"
      value="#{mainPubFormBean.resources}"
      binding="#{mainPubFormBean.dataUI}"
      var="resourceDataLine">
        <h:column>
          <h:command_link id="goToFolder"
          action="#{mainPubFormBean.goToResource}"
          rendered="#{resourceDataLine.folder}"
          title="#{resourceDataLine.localizedResourceName}">
           <h:output_text   value="#{resourceDataLine.abbreviatedResourceName}"
              styleClass="time-table-text"/>
           </h:command_link>
        </h:column>
    </h:data_table>It causes NullPointerException,
    java.lang.NullPointerException
            at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:415)
            at javax.faces.webapp.UIComponentTag.isSuppressed(UIComponentTag.java:777)
            at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:447)
            at com.sun.faces.taglib.BaseComponentTag.doStartTag(BaseComponentTag.java:929)
            at org.apache.jsp.main_jsp._jspx_meth_h_command_link_6(main_jsp.java:1954)
            at org.apache.jsp.main_jsp._jspx_meth_h_column_0(main_jsp.java:1834)
            at org.apache.jsp.main_jsp._jspx_meth_h_data_table_0(main_jsp.java:1498)Here is the UIComponentBase.isRendered code fragment:
        public boolean isRendered()
            if(renderedSet)
                return rendered;
            ValueBinding vb = getValueBinding("rendered");
            if(vb != null)
                Boolean value = (Boolean)vb.getValue(getFacesContext());
                return value.booleanValue();  <----- value can be null
            } else
                return rendered;
        }The code should test if the value if null or not before calling booleanValue().

    Thanks. Good news: we already nailed this bug.
    -- Adam Winer

  • Command_link within a data_table has problem getting value parameter

    Hi
    I have a data table displaying names of users using command_links as below...
    <h:data_table id="Contacts" value="#{ContactGenericList.objSet.dataList}" var="conIdx">
    <h:column>
    <f:facet name="header">
    <h:command_link id="sortByLastName" actionListener="#{MYActionListener1}" value="test1">
    <h:output_text value="Last Name"/>
    </h:command_link>
    </f:facet>          
    <h:command_link id="LastNameLink" actionListener="#{MYActionListener2}" value="test2" >
    <h:output_text value="#{conIdx.lastName}"/>
    </h:command_link>
    </h:column>
    As you see I have two command_links (both of them have value params). When I select the first one (sortByLastName) I get the value param in the event.
    But when I select the second link (LastNameLink) I get the value param as null.
    The first link only appears once (as header). The second one appears for each row... Could this be the problem.. Any solution please
    Thanks

    Thanks Adam, I got this resolved by using
    Contact currCont = (Contact)context.getExternalContext().getRequestMap().get("conIdx");
    and getting necessary values from Contact obect... :)

  • Help with command_link .. PLEASE ... URGENT

    Hi
    I am new to JSF. I am using a command_link to generate a link. Since I need to generate lot of links, I use a JSTL forEach loop.
    Since I am generating this in loop I don't use the "id" within the command_link . The code is as below>
              <c:forEach var="item" items="${MyBean.queryFilters}">
              <c:set var="sortLink" value="${item}" scope="request"/>
              <h:command_link actionListener="#{MyBean.selectQueryLinks}">
              <h:output_text value="#{sortLink}"/>
              <f:parameter name="linkName" value="#{sortLink}"/>
              </h:command_link>
              </c:forEach>
    The links are being generated fine, but when user selects a link I need to know which link he selected...
    I used f:parameter to get the linkname. But on server side I am unable to retrieve this.
    How do I get this parameter....
    The client side html generated something like...
              <a href="# onmousedown="document.forms[0['_id0:_id5'].value='_id0:_id5';document.forms[0]['linkName'].value='0-9'; document.forms[0].submit()">0-9</a><input type="hidden" name="_id0:_id5" /><input type="hidden" name="linkName" value="0-9" />
    I need to get hold of "linkname"...
    Thanks
    Kishore

    In your original post:
    <c:forEach var="item" items="${MyBean.queryFilters}">
    <c:set var="sortLink" value="${item}" scope="request"/>
    <h:command_link actionListener="#{MyBean.selectQueryLinks}">
    <h:output_text value="#{sortLink}"/>
    <f:parameter name="linkName" value="#{sortLink}"/>
    </h:command_link>
    </c:forEach>
    If you want to retrieve the value of the linkName parameter, code your actionListener as follows:
    public void selectQueryLinks( ActionEvent evt ) {
         UICommand command = (UICommand)evt.getComponent();
         List commandChildren = command.getChildren();
         for ( Iterator it = commandChildren.iterator(); it.hasNext(); ) {
              UIComponent child = (UIComponent) it.next();
              if ( child instanceof UIParameter ) {
                   String parmName = (String) ( (UIParameter)child ).getName();
                   if ( parmName.equals("linkName") ) {
                   _linkName = (String) ( (UIParameter)child ).getValue();
                   break;
    // ...... Other processing......

  • How to render the command_link with 'onmouseclick' ?

    The <h:command_link> tag gets rendered as <a ... onmousedown="...">.
    I would prefer onmouseclick instead. Is there a way to modify this behavior? (without wrinting my own tag ;-)
    Wolfgang Oellinger

    Nope, sorry. I think this may actually be a bug, so I'll bring it to the EG list.
    Hans Bergsten (EG member)

  • Reliability problem with command_link

    Hello,
    I'm having problems with the command_link tag.
    It happens with Mozilla Firefox, it seems to work 100% with IE.
    The problem, I think, is linked to the use of Javascript, sometimes it works, sometimes it doesn't. Sometimes, the javascript is executed and everything is ok, and sometimes the href="#" is executed and the behaviour isn't correct.
    This is the code:
    <h:command_link action="#{homeBean.viewAction}">
         <h:output_text value="#{currentElement.reference}"/>
    </h:command_link>
    and the generated HTML:
    <a href="# onmousedown="document.forms[3['homeView:homeForm:table:11:_id23'].value='homeView:homeForm:table:11:_id23'; document.forms[3].submit()">ref12</a>
    Any ideas are welcome,
    Thanks
    Fred

    Has anyone solved this problem, it rears its ugly head with both browsers.
    And you can't add onclick attribute to the <h:commandLink> tag because it doesn't allow that to occur.

  • Problem with rendering h:command_link

    <h:command_link action="sayHello">Say Hello</h:command_link> is rendered into
    Say Hello<a href="# onmousedown="......"></a><input type="hidden" name="helloForm:_id4" />
    So, the link title is out of tag. Is this just a bug or I miss something? Using <f:verbatim> around the title fixes the problem, but requires only a plain text inside.

    I think you're supposed to do the following (haven't
    double checked, but I think it's right)
    <h:command_link action="sayHello">
    <h:graphic_image url="MySubmitButton.gif" />
    </h:command_link>
    Yes, that's correct. The <h:graphic_image> action element creates a JSF UIGraphic component with an Image renderer as a child of the UICommand component, and it's used to generate the "link text" (i.e., the content of the HTML <a> element).
    As I said earlier, any JSF component action element can be nested in the <h:command_link> element like this to generate the "link text". You cannot, however, use plain text or non-JSF action elements to generate the "link text". If you do, the "link text" ends up outside of the HTML <a> element.

  • Error: command_link in data_table header

    This is an error report of JSF1.0Beta (I did not find it yet reported)
    Command links in a header section of a data_table invoke the associate Action X. times instead of one single time. (X is the number of rows currently shown in teh data_table).
    The same command_link anywhere else works just fine!
    Here teh sample code
    <h:data_table id="table"
    styleClass="list"
    binding="#{ItemSearchBean.dataTable}"
    value="#{ItemSearchBean.backingBeans}"
    var="bean">
    <h:column>
    <f:facet name="header">
    <h:command_link id="submit-removeAll" action="#{ItemSearchBean.removeAllAction}">
    <h:graphic_image url="/images/remove.png" alt="#{bundle.Command_remove_all_label}" />
    </h:command_link>
    </f:facet>
    <h:selectboolean_checkbox id="selected" value="#{bean.selected}"/>
    </h:column>

    This bug has already been reported:
    http://forum.java.sun.com/thread.jsp?forum=427&thread=481280
    Don't think there is a workaround yet. :(

  • Capturing value attribute from command_link

    Hi
    I have a command_link with no id attribute but a value attribute set ... as below:
    <h:command_link value="xxxx" actionListener="yyy"... />
    When the link is selected the yyy method is being called but how do I get the xxxx (of value attribute)...?
    Thanks
    Kishore

    Adam,
    That does not work...
    Here is my command_link
              <h:command_link id="LastNameLink" actionListener="#{ContactGenericList.editContact}" value="test" styleClass="navControlLink">
              <h:output_text styleClass="navControlLink" value="#{conIdx.lastName}"/>
         </h:command_link>
    I used value=test and in editContact method, I did
    String idVal = (String)((UICommand) event.getSource()).getValue();
    and it ALWAYS shows up as null.
    Please help
    thanks

Maybe you are looking for

  • Unable to log in to the FileVault user account

    I was unable to log in to the FileVault user account at this time because an error occurred. Q.1: What is FileVault user account? I can't reset a new password and to unlock FileVault even my master password is correct. Q.2: What can I do to solve thi

  • Layout & printing of avery labels...

    I am trying to figure out how to layout & print avery labels...5160 with a picture/symbols. I do not want to print from address book...I want to be able to print an entire page of the same symbol like I could on a pc in word!

  • Loading multi numeric

    I'm having a problem loading properties from an access database for a multi-numeric type test. The loading works fine for single numerics and strings but I can't seem to figure out how to configure the database and the multinumeric test to play toget

  • Unfreezing the Months in Demand Planning book.

    Hello Experts, User has limited access of change mode (6 months) in a particular demand planning book. User wants to extend the change access horizon to 10 months. Please guide me what necessary steps to be taken so that user has access to do changes

  • Conditional formating of time eg highlight all 7:00 PM

    Hi, So my problem is that i have a large registration of times and i would like to highlight ALL the, example, 7:00 PM. however i have not been able to do so.... I have tried linking to different cells, inputing the time and none of it works. when i