Results 1 to 2 of 2
  1. #1
    Srikala is offline Member
    Join Date
    Aug 2008
    Posts
    10
    Rep Power
    0

    Default jsf command link

    Hi friends ,
    i have created one jsf page in that 2 commandlinks are there,if we click firstlink it goes to first page and if 2nd it goes to second page,but in my code it is not going next page please see my code and give me solution,
    thanks in advance
    my code:

    <%@ page contentType="text/html"%>
    <%@ taglib uri="/WEB-INF/html_basic.tld" prefix="h" %>
    <%@ taglib uri="/WEB-INF/jsf_core.tld" prefix="f" %>

    <f:view>
    <html>
    <head>
    <title>Users</title>
    <link rel="stylesheet" type="text/css" href="css/styles.css">
    </head>
    <body>
    <h:form>
    <!-- MAIN Table-->
    <table width="100%" cellpadding="0" cellspacing="0" height="100%">
    <tr>
    <td>
    <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td class="mainbgbar" width="80%" valign="baseline">

    </td>
    <td class="connector" width="">
    &nbsp;
    </td>
    <!-- logo rightside -->
    <td align="center" valign="middle" width="13%">

    <h:graphicImage id="gi" alt="The image could not be found."value="" width="150" height="150" title="This is demo for 'graphicImage' tag" ></h:graphicImage>
    </td>
    </tr>
    </table>
    </td>
    </tr>

    <tr>
    <td class="bgy">
    <table width="100%" height="100%">
    <tr>
    <td align="right">
    &nbsp;
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr></tr><tr></tr>

    <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
    <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
    <tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
    <tr>
    <td>
    <h:form>
    <h:commandLink id="link1" value="Add Users." action="addusers" /><br></br>
    <h:commandLink id="link2" value="AddField Users." action="addfieldusers" /><br></br>
    </h:form>
    </td>
    </tr>

    <tr height="90%">
    <td width="100%" valign="middle" align="center">


    <!-- MAIN FRAME -->
    <table width="100%" height="100%" align="center">
    <table class="tbl" height="50%" width="25%" border="0" cellspacing="0" cellpadding="10" >

    <tr class="mainbgbar">
    <td colspan="2" class="title"><b>&nbsp;Users</b></td>
    </tr>

    <tr>
    <td>&nbsp;<h:outputText value="Name:" styleClass="lable"/></td>
    <td>&nbsp;<h:inputText id="Name" value="" /></td>
    </tr>
    <tr>
    <td>&nbsp;<h:outputText value="EmpId:" styleClass="lable"/></td>
    <td>&nbsp;<h:inputText id="EmpId" value="" /></td>
    </tr>
    <tr>
    <td>&nbsp;<h:outputText value="EmailId:" styleClass="lable"/></td>
    <td>&nbsp;<h:inputText id="EmailId" value="" /></td>
    </tr>
    <tr>
    <td>&nbsp;<h:outputText value="MobileNo:" styleClass="lable"/></td>
    <td>&nbsp;<h:inputText id="MobileNo" value="" /></td>
    </tr>
    <tr>
    <td>&nbsp;<h:outputText value="Username:" styleClass="lable"/></td>
    <td>&nbsp;<h:inputText id="username" value="" /></td>
    </tr>
    <tr>
    <td>&nbsp;<h:outputText value="Password: " styleClass="lable"/></td>
    <td>&nbsp;<h:inputSecret id="password" value="" /></td>
    </tr>
    <tr>
    <td>
    <center>
    <h:form>
    <h:commandButton value="submitt" action="" styleClass="button"/>
    </h:form>
    </center>
    </td>
    </tr>
    </table>

    <!-- END OF MAIN FRAME -->
    </table>
    <tr>
    <td class="mainbgbar" height="20" align="center">

    </td>
    </tr>
    </table>
    <!-- End of MAIN Table-->
    </h:form>
    </body>
    </html>
    </f:view>

    faces-config.xml:

    <navigation-rule>
    <from-view-id>/pages/admin.jsp</from-view-id>
    <navigation-case>
    <from-outcome>addusers</from-outcome>
    <to-view-id>/pages/addusers.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>addfieldusers</from-outcome>
    <to-view-id>/pages/addfieldusers.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>

  2. #2
    smithahrao is offline Member
    Join Date
    Jun 2009
    Posts
    8
    Rep Power
    0

    Default

    I saw multiple nested h<:form> in you code. Have only one <h:form> (not nested) then it should work

Similar Threads

  1. jsf command link
    By Srikala in forum JavaServer Faces (JSF)
    Replies: 2
    Last Post: 06-29-2010, 03:38 PM
  2. jsf command link navigation case
    By Srikala in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 03-23-2009, 12:16 PM
  3. Link for 64 bit JDK.
    By aparna in forum New To Java
    Replies: 0
    Last Post: 03-19-2008, 03:15 PM
  4. Link List
    By one198 in forum New To Java
    Replies: 0
    Last Post: 10-14-2007, 02:33 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 01:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •