Command Link usage in JSF datatable

Hi,
Following is my requirement. Can any one help me in resolving the issue.
I hava a JSF page which displays a datatable. One of the columns in the datatable displays a command link. When the user clicks the link in a particular row. Details correpsonding to the particular row have to be displayed in another page. I am using action attribute to perform the navigation from first page to next. Inside action method in the backing, is there any other means to get the row data from the datatable for which the link is clicked.
Please help.

You may find this article useful: http://balusc.blogspot.com/2006/06/using-datatables.html

Similar Messages

  • Command link usage.

    Hi,
    I am using </h:commandLink > tag to generate command links in each row of <h:table> tag. simple code i am using:
    <h:dataTable value="#{projectBean.projects}" var="projectsData">
    <h:column>
    <f:facet name="header">Name</f:facet>
    <h:outputLink value="#{projectBean.getProjectDetails">
    <h:outputText value="#{projectsData.name}"/>
    <f:param name="pId" value="#{projectsData.projectId}"/>
    </h:outputLink>
    </h:column>
    <h:column>
    <f:facet name="header">Date</f:facet>
    <h:outputText value="#{projectsData.stDate"/>
    </h:column>
    </h:table>
    I am able to generat the link with the param value passing but the action method is not getting invoked on press of the link, could any one help me in usage of commandlink tag in invoking action page.
    Regards
    Mruthyunjaya

    I have used the command link instead of outLink also the tag is under form tag only but still the link action is not executed.
    if i changed the bean to session scope it is running fine, but as the bean is session scope it is displaying old values along with new values, i.e. the form is displayed with repeated values.
    can some one help me in solving this problem.
    thanks
    Mruthyunjaya

  • JSF Command Link inside DataTable has to be clicked twice in order to work

    I currently have a command link inside of a dataTable. However, when I go to the page and click the link nothing happens. It appears that the page is refreshed but looking at the logs nothing is done. However, if you click the same link again everything is updated properly. How do I get the command link to work properly? And, I have everything operating in the session scope.

    sdgorham wrote:
    No I do not have h:messages on the page. Just add it for debugging purposes. There might have been a validation or conversion error occurred which wasn't 'catched' by any h:message.
    Unfortunately, upgrading to another version isn't an option at the moment. OK, I checked the MyFaces page and 1.1.5 is indeed the latest JSF 1.1 implementation.
    Is there any other possible solutions that are more like a hyperlink than the command button. What exactly is causing the problem that I described?Have you tried if it works with a button or not? Only then we can be more sure about the cause of the problem.

  • Command Link as a row of a datatable in JSF

    Hi All,
    I am new to JSF. I have a Datatable with n number of rows.
    I would like to have a command Link in each of the rows, so that when i click the command link i should get the data of the entire row in my edit page.
    Can anyone suggest how can i achieve this.
    Regards
    SN

    Hi,
    Do following:
    1- add a datatable in your page and fill it with data comes from database(Assume u have no problem with datatable)
    2- add a column as commandLink in data table. e.g.
    <h:column>
    <f:facet name="header">
    <h:outputText value="name" />
    </f:facet>
    <t:commandLink action="editObject" immediate="true" >
    <h:outputText value="#{theobject.name}" />
    <t:updateActionListener property="#{objectForm.id}" value="#{objectDto.id}" />
    </t:commandLink>
    </h:column>
    in this code:
    "name" is header of column,
    "editObject" is defined in navigation rule to navigate to edit page, lets say object form.
    "theobject.name" the value that mouse gets finger over it!
    "objectForm.id" the pointer to an "id setter" of a managed bean (named objectForm) defined in faces-config.xml. In this setter you can load corresponding data from database
    "objectDto.id" the pointer to an "id getter" of a managed bean (named objectDto) defined in faces-config.xml. this getter return the id of the entity row you clicked on.
    3- Clearly, you need to defined all managed beans, and dont forget to have a customized setter for id of objectForm (setId) to load the entity from database and fill all editable properties(as you like) in this function (setId).
    4- you need a JSF page to redirect to it for editing properties and feed by objectForm
    5- Thats it :)

  • Command Link inside of datatable

    I have the following problem when I put a command link inside a datatable.
    The action or actionlisteners never get called. Now here is the funny thing.
    1. If I move the action link outside the datatable it works.
    2. if I change the scope of the bean to session it works
    3. if the datatable contains more than 1 row it works
    The last one tells me this is a bug.
    To test this I change the sql query to limit the result so 1 row would be returned.
    The sql query returns a CachedRowSetImpl
    I believe this is a bug.
    <h:dataTable rows="6" first="0" id="table" binding="#{event.eventdata}" value="#{event.eventdetails}" var="eventdetail">
    <h:column>
    <h:commandLink value="#{eventdetail.title}" action="#{event.resaveEventaction}" actionListener="#{event.resaveEventdetails}" id="test" >
    </h:commandLink>     
    </h:column>
    <h:column>
    </h:dataTable>

    Here is some additional information that makes this more confusing.
    The following code is used to populate the datatable
    public CachedRowSetImpl getEventdetails(){
         CachedRowSetImpl rs2 = null;
         String selectedeventmy = selectedevent;
         int rowcount = 0;
         try { 
              sql = "SELECT * FROM event where eventid='"+selectedeventmy+"' ";
              rs2 = RunQuery.mysql(sql);
              rowcount = rs2.size();
         } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         return rs2;
    where RunQuery.mysql is
    public class RunQuery {
         public static CachedRowSetImpl mysql(String sql) throws Exception {
              CachedRowSetImpl crset = null;
              InitialContext initCtx = new InitialContext();
              Context envCtx = (Context) initCtx.lookup("java:comp/env");
              try {
                   DataSource ds = (DataSource) envCtx.lookup("jdbc/associations");
                   Connection conn = null;
         Statement stmt = null;
         conn = ds.getConnection();
         stmt = conn.createStatement();
         stmt.execute(sql);
         ResultSet rs = stmt.getResultSet();
         crset = new CachedRowSetImpl();
         crset.populate(rs);
         rs.close();
         stmt.close();
         conn.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
              return crset;
    if I replace the line
    String selectedeventmy = selectedevent;
    with String selectedeventmy = "61";
    it works properly.
    selectedevent is populated from the following triggered by another action event on another page. ? The funny thing is if the result set returns more that 1 row all works ok.
    public String viewDetails(){
         System.out.println("Running view Details");
         int selectedrow = eventlist.getRowIndex();
         Object selected = eventlist.getRowData();
         Map rowdata = (Map) selected;
         selectedevent = rowdata.get("eventid").toString();
         System.out.println("Selected Event:"+selectedevent);
         outcome="eventdetails";
         return outcome;
    }

  • Command links in h:datatable not working

    I have some command links in h:datatable which are not working. When I click the command link all I get is a referesh page(same page is displayed with datatable values as null). But when I put command link outside h:datatable, the navigation takes place properly. Any idea what could be worng

    You can try using t:dataTable from tomahawk.jar, instead of the h:dataTable. Make the following changes in your code.
    1. Add the taglib uri in your JSP as,
    <%@ taglib uri = "http://myfaces.apache.org/tomahawk" prefix="t" %>
    2. Add the tomahawk-1.1.3.jar to your WEB-INF/lib folder.
    3. Instead of using h:dataTable, use t:dataTable.
    4. After the form save your bean's state as,
    </h:form>
    <t:saveState id="viewForm" value="#{stateBean}"/>
    Here, id can be any name and the value should be the name of your bean, how u have used in your JSP.
    I hope this will help you.

  • Dynamic datatable and command link

    I'm having a problem creating CommandLink's automatically. What we have is a tag, which can contain a set of data. We need this on several locations, so we have to create a datatable dynamically. When you press a link, it should be possible to retrieve the ID of the component on that specific row.
    The problem is, we can create the table with the necessary data. When I construct the column with the ID (and the link), it fails.
    Code:
    HtmlCommandLink link = new HtmlCommandLink();
    Application app = FacesContext.getCurrentInstance().getApplication();
    ELContext elContext = FacesContext.getCurrentInstance().getELContext();
    ValueExpression ve = app.getExpressionFactory().createValueExpression(elContext,"${" + TABLE_VAR_NAME + "." + property + "}", Object.class);
    link.setValueExpression("value", ve);
    link.getAttributes().put("rowId", ve.getExpressionString() );
    link.addActionListener(
        new ActionListener(){
         public void processAction(ActionEvent arg0)
              throws AbortProcessingException {
              LOG.info(">>>>>>>>>>>>> Linked pushed !!"  +
              arg0.getComponent().getAttributes().get("rowId"));
    selectColumn.getChildren().add(link);
    datatable.getChildren().add(selectColumn);The rowId is always #{row.code}, instead of the actual data. Is there a way to create a command link dynamically, press it and retrieve the ID of that field? That expression should be evaluated at runtime and added to the datatable, but that doesn't happen apparently.

    I've read your article, but I didn't find anything I could use. Facing a deadline and don't really have time to try out multiple (possible) solutions. The problem is that all the examples I can find point to MethodBinding, but I don't need that. I just need to get the ID of the row that was clicked, nothing more.
    This works fine:
    link.setValueExpression("value", ve);I don't see why the other expression isn't evaluated.
    I can do getParent().getParent() to get a reference to the DataTable, but the datamodel on that object is empty btw.

  • Can we use JSF Command Link as an external Link.

    Hi there,
    i am using JSF command Link.Now i had a requirement to pass those links to clients through mails. is it possible to pass those links through mail. please help me out on this since many real time applications demand these scenario.
    Regards,
    A.

    yes. that's working.. Thank you.
    Regards,
    A.

  • JSF Command Button and Command Links

    The main page of my JSF application has a Save button and Command Links. After making any changes on the main page the user should click Save before using any of the Links. Most of the time almost all users do this. However, some users are making changes then clicking a Link, thereby losing their changes.
    I could always execute my save method in the backing bean when a link is clicked, but, most of the time this would be doing a lot of processing which usually would not be necessry.
    Is their some way to check if any changes have been made and then doing the save only when necessary?
    Regards,
    Al Malin

    Anybody?
    What would be beneficial is something like this. If somehow it could be determined if any of the JSF fields on the page were modified. Then, in the backing bean method that handles the ActionEvents for the links, I would check if changes were made and, if so, call my save method.
    In other words is it possible to determine, in the backing bean, whether or not JSF fields have changed?
    Regards,
    Al Malin

  • Resetting the id of dynamically generated JSF custom command link

    I have a java faces page which displays data from an arraylist.
    This list is populated when user inputs data in the input text field and clicks "Add Group" button.
    The arralylist consist of another arraylist within the former.
    I have created a custom command link for the former arraylist.
    As an user can add data to the arraylist so can he remove it from the arraylist.
    The command link has a method binding "closeTask" which is invoked when command link is clicked.
    This action removes the clicked element from the arraylist and displays the fresh list.
    The key field from the bean in the former arraylist is set in request, and is retrieved in the "closeTask" method to be assigned to the command link output text id (i.e. it identifies the element that is to be deleted from the arraylist).
    This functionality does not work as expected, i.e. command link component is not created/rendered during deletion as it is created while addition.
    As a result eventhough the element is removed from the arraylist, the id corresponding to the fresh arraylist is not refreshed and for further actions correct id is not passed and the deletion function does not work.
    How can I have resolve this problem?
    The sample code is included.
    Thanks in advance.
    Java Faces Code:
    <%
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    Bkbean bean = (Bkbean)app.createValueBinding("#{bckbean}").getValue(facesContext);
    List aList = bean.getAList();
    if(aList!=null && aList.size()>0) {                                                            
    for(int i=0; i<aList.size(); i++) {
    ABean abean = (ABean) aList.get(i);
    int keyValue = abean.getKey();
    request.setAttribute("key", String.valueOf(keyValue));
    %>
    <TR>
    <TD width="90%">
    <%=abean.getCtg()%>
    </TD>
    <TD width="9%">
    <%=abean.getKey()%>
    </TD>
    <TD width="1%" align="right" valign="top">
    <h:commandLink binding="#{bckbean.commandLnk}" styleClass="commandLink">
    </h:commandLink>
    </TD>
    </TR>
    <%
    List dList = abean.getDList();
    if(dList!=null) {
    for(int j=0; j<dList.size(); j++) {
    String tData = (String) dList.get(j);
    %>
    <TR>
    <TD width="90%">
    <%=tData%>
    </TD>
    <TD width="10%" colspan="2">
    </TD>
    </TR>
    <%
    }%>
    <%
    %>
    <TR>
    <TD align="right">
    <h:inputText id="inputtxt001" value="#{bckbean.val}"></h:inputText>
    </TD>
    <TD align="left" colspan="2">
    <hx:commandExButton type="submit" value=" Add Group " styleClass="commandExButton" id="submitbtn001" action="#{bckbean.addVal}">
    </hx:commandExButton>
    </TD>
    </TR>
    Backing Bean Code:
    public void closeTask(ActionEvent event) {
    String key = "";
    UIOutput lnkTxt = null;
    UICommand comp = (UICommand)event.getComponent();
    if(comp.getChildren() != null && comp.getChildren().size() >0) {
    for (int i=0; i<comp.getChildren().size(); i++) {
    lnkTxt = (UIOutput)comp.getChildren().get(i);
    key = lnkTxt.getId();
    int selectedKey = (new Integer(key.substring(2))).intValue();
    if(aList!=null) {
    for(int i=0; i<aList.size(); i++) {
    ABean abean = (ABean) aList.get(i);
    if(abean.getKey()==selectedKey) {                                             
    aList.remove(i);
    break;
    public UICommand getCommandLnk() {
    String id = (String) request.getAttribute("key");
    UICommand commandLnk = new UICommand();
    commandLnk.setId("key" + id);
    UIOutput outTxt = new UIOutput();
    outTxt.setId("id"+id);
    outTxt.setValue("X");
    commandLnk.getChildren().add(outTxt);
    MethodBinding mb = app.createMethodBinding("#{bckbean.closeTask}", new Class[]{ActionEvent.class});
    commandLnk.setActionListener(mb);
    commandLnk.setImmediate(true);
    return commandLnk;
    }

    You cud define jsObjectNeeded and onClientClick properties for the htlm component and catch the event to find itz ID.
    This might help you:
    Accessing HTMLB form values from JAVASCRIPT
    To give you an idea abt how the code works:
    Portal: Bug in the  radio button's javascript api
    Regards,
    N.
    Plz click a star if it helped.

  • Same JSF page being shown for different command links

    Hi
    I have two command links and as per navigation-rules, both of them go to the same page "Common.jsp" which has a <jsp:include> to include another file which is gets from session.
    Each command link specifies its own JSP page to be included (in common.jsp) and adds them to the sesion.
    After selecting one command link the desired page is showing up fine...
    However if I come back and select the second command_link, it shows the same page again.
    It does not even go to the action_listener of the second command_link.
    Is there any way to force it go to the actionlistener of the command_link where I can specify a different page in the session... ?
    Thanks

    Hi
    I have two command links and as per navigation-rules,
    both of them go to the same page "Common.jsp" which
    has a <jsp:include> to include another file which is
    gets from session.
    Each command link specifies its own JSP page to be
    included (in common.jsp) and adds them to the sesion.
    After selecting one command link the desired page is
    showing up fine...
    However if I come back and select the second
    command_link, it shows the same page again.
    It does not even go to the action_listener of the
    second command_link.
    Is there any way to force it go to the actionlistener
    of the command_link where I can specify a different
    page in the session... ?
    What do you mean by "specify a different page in the session"? An <h:command_link> always goes back to the page it was originally rendered from, and expects the action invoked by the command to determine where to go next. If you really want to go to different pages, you should either make the action method return different results (i.e. trigger different navigation rules) or consider using <h:output_link> instead, where you can define the destination URL yourself.
    Craig McClanahan
    Thanks

  • Invoke Edit action once I click on Command Link,,,,,, Help me out in

    Hi
    I am having a datatable , which consists of of ROWS, & Columns
    when I click on that command link, it shoud open a property page with all the bean data populated,,,, "I am using the same Add property page for edit also", Now I am modifying the data and click on "Add", Now It should call[b] UpdateQuery ie, ModifyServiceDomain instead of Insert Query "Add ServiceDomain".., Tell me how to do that...
    How to solve the above problem..
    Java Class:
    public class ServiceDomainEventHandler {
        * This method is used to modify a service domain from the Web UI.
        * @return "succuess", if a service domain can be modified successfully,
        *         "failure", if a service domain can not be modified
       public String modifyServiceDomain()
          log.debug( "Into modifyServiceDomain method" );
          String returnStr = "edit_SD";
          FacesContext facesContext = FacesContext.getCurrentInstance();
          ExternalContext externalContext = facesContext.getExternalContext();
          HttpServletRequest request = (HttpServletRequest) externalContext
                .getRequest();
          String serviceDomainName = (String) request
                .getParameter( "serviceDomainName" );
          ServiceDomain servicedomain = null;
          try
             servicedomain = new ServiceDomainDbAccess()
                   .getServiceDomainByName( UIConstants.WHICH_DB,
                         serviceDomainName );
          catch (SQLException pe)
             pe.printStackTrace();
          try
             servicedomain = new ServiceDomainMgerImpl().getServiceDomainById(
                   UIConstants.WHICH_DB, Integer.parseInt( servicedomain
                         .getId() ) );
             if (servicedomain != null)
                facesContext.getExternalContext().getRequestMap().put(
                      "ServiceDomain", servicedomain );
             else
                log.debug( "Unable to obtain the ServiceDomain!" );
          catch (NrsProvisionException pe)
             returnStr = "failure";
             handleUIErrors( facesContext, pe );
          log.debug( "modifyServiceDomain method return value: " + returnStr );
          return returnStr;
        * This method is used to add a service domain from the Web UI.
        * @return "succuess", if a service domain can be added successfully,
        *         "failure", if a service domain can not be added
       public String addServiceDomain()
          log.debug( "Into addServiceDomain method" );
          String returnStr = "success";
          FacesContext facesContext = FacesContext.getCurrentInstance();
          ExternalContext externalContext = facesContext.getExternalContext();
          Map requestMap = externalContext.getRequestMap();
          ServiceDomain curServiceDomain = (ServiceDomain) requestMap
                .get( "ServiceDomain" );
          try
             new ServiceDomainMgerImpl().addServiceDomain( curServiceDomain );
          catch (NrsProvisionException pe)
             returnStr = "failure";
             handleUIErrors( facesContext, pe );
          log.debug( "addServiceDomain method return value: " + returnStr );
          return returnStr;
    Jsp Page:
    <%@ page language="java" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:view>
         <f:loadBundle basename="com.nortel.ems.mgmt.nrsm.messages.ServiceDomainMessageBundle" var="bundle"/>
         <%
              String path = request.getContextPath();
              String basePath =
              request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
         %>
         <html>
              <head>
                   <base href="<%=basePath%>">
                   <link REL="stylesheet" TYPE="text/css" HREF="<%= request.getContextPath()%>/css/nrsStyle.css">
                   <title>Service Domain add page</title>
              </head>      
              <body>
              <f:verbatim>
              <div
                   style="height:500px;overflow: scroll; margin-top: -2px;margin-bottom: -2px;border: 1px solid #CCCCCC; border-top:none;width:100%">
         </f:verbatim>
                   <h:panelGroup id="SDPanel" styleClass="panelGroup">
                        <h:form id="SDForm" >                    
                             <h:panelGroup id="SDSubPanel" >
                               <h:panelGrid id="SDPanelGrid" styleClass="panelGrid"
                                              columnClasses="panelGridCol1,panelGridCol2,panelGridCol3,panelGridCol4"
                                            headerClass="tableHeaders" columns="4">   
                                    <f:facet name="header">     
                                         <h:outputText id="SDHead" value="#{bundle.serviceDomainAdd}"/>   
                                    </f:facet>                                                
                                  <h:message for="SDForm" styleClass="fieldErrors" />
                                  <h:outputText id="BlankCol1" value=""/>                                 
                                  <h:outputText id="BlankCol2" value=""/>                                 
                                  <h:outputText id="BlankCol3" value=""/>                                                               
                                    <h:outputText id="SDName" value="#{bundle.serviceDomainName}"/>
                                    <h:inputText id="name" value="#{ServiceDomain.name}" />
                                  <h:outputText id="Mandatory" value="*"/>                                 
                                    <h:message for="name" styleClass="fieldErrors" />
                                    <h:outputText id="SDDesc" value="#{bundle.serviceDomainDesc}"/>
                                    <h:inputTextarea id="description" value="#{ServiceDomain.description}" />   
                                  <h:outputText id="BlankCol4" value=""/>                                 
                                    <h:message for="description" styleClass="fieldErrors" />
                               </h:panelGrid>            
                             </h:panelGroup>
                   <h:panelGroup styleClass="buttonpanelright">
                        <h:commandButton id="AddSD" action="#{ServiceDomainEventHandler.addServiceDomain}" value="#{bundle.serviceDomainSave}"/>
                             <h:commandButton id="CancelSD" action="#{ServiceDomainEventHandler.cancel}" value="#{bundle.serviceDomainCancel}" />
                   </h:panelGroup>
              </h:form>
         </h:panelGroup>
         <h:outputText id="SDMandatoryIndicator" styleClass="mandatory" value="#{bundle.mandatory}"/>
         <f:verbatim>
              </div>
         </f:verbatim>
         </body>
         </html>
    </f:view>[code[/code]]

    update your adobe reader here, http://get.adobe.com/reader/
    untick unwanted tag-along ware.

  • How to iterate command Links

    Hi,
    My problem is as i want to show the commandlinks based on database records. Thus under each commandlink I have to show the sub command Links which sense like the sub categories. Any help regarding this.
    many thanks ,
    vijaycanaan.

    Iam using the sun 's core jsf tags <h:dataTable>. Here below is my code if u get confused with my code please leave it and give the solution for bindings.
    [u]view page[/u]
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <f:view>
            <h:form>
                <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                    <title>JSP Page</title>
                </head>
                <body>
                    <h:dataTable
                     binding="#{MultipleDataGrids.data}"
                        value="#{MultipleDataGrids.results}"
                        var="outerItem"
                    >
                        <h:column>
                            <h:commandLink action="#{MultipleDataGrids.action}">
                                <h:outputText value="#{outerItem.catName}" />
                            </h:commandLink>
                            <h:dataTable
                            binding="#{MultipleDataGrids.data2}"
                                value="#{outerItem.subCatList}"
                                var="innerItem"
                            >
                                <h:column> </h:column>
                                <h:column>
                                    <h:commandLink action="#{MultipleDataGrids.action2}">
                                        <h:outputText value="#{innerItem.catName}" />
                                    </h:commandLink>
                                </h:column>
                            </h:dataTable>
                        </h:column>
                    </h:dataTable>       
                </body>
            </h:form>
        </f:view>
    </html>
    [u]Backing Bean[/u]
    * MultipleDataGrids.java
    * Created on May 3, 2007, 5:59 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package com.gd.util;
    import java.util.List;
    import java.util.ArrayList;
    import java.sql.*;
    import com.gd.Category;
    import javax.faces.component.UIData;
    import javax.faces.context.FacesContext;
    * @author OM SAI
    public class MultipleDataGrids {
        List results;
        UIData data;
        UIData data2;
        public void setData2(UIData data2) {
            this.data2 = data2;
        public UIData getData2() {
            return data2;
        public void setData(UIData data) {
            this.data = data;
        public UIData getData() {
            return data;
        public List getResults() {       
            results=new ArrayList();
            Connection con=new data.DBConnect().init();
            try {
                Statement request=con.createStatement();
                Statement request2=con.createStatement();
                ResultSet rs1,rs2;
                rs1=request.executeQuery("Select * from catalog WHERE parentid='0' order by catalogname");
                while(rs1.next()) {
                    Category temp=new Category();
                    temp.setCatName(rs1.getString("catalogname"));
                    temp.setCatId(rs1.getString("catalogid"));
                    temp.setSubCatList(new ArrayList());
                    rs2=request2.executeQuery("select * from catalog where parentid='"+temp.getCatId()+"' order by catalogname");
                    while (rs2.next()) {
                        Category ntemp=new Category();
                        ntemp.setCatId(rs2.getString("catalogid"));
                        ntemp.setCatName(rs2.getString("catalogname"));
                        temp.getSubCatList().add(ntemp);
                    results.add(temp);
                con.close();
            } catch (Exception e) {
                System.out.println(e);
            return results;
        public MultipleDataGrids() {
        public String action() {
            Category selected = (Category) this.getData().getRowData();
            System.out.println(selected.getCatName());
            FacesContext ctx = FacesContext.getCurrentInstance();
            ctx.getExternalContext().getSessionMap().put("NewsBeanMore", selected);
            return "morenews";
        public String action2() {
            return "morens";
    [u]FacesConfig.xml
    [/u]
      <managed-bean>
        <managed-bean-name>MultipleDataGrids</managed-bean-name>
        <managed-bean-class>com.gd.util.MultipleDataGrids</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>

  • Command Link problem-Urgent

    Hi
    I am having Tabbedpane, under that I am including three jsp files...
    which contains a dataTable , having one column data as a commandLink which inturn opens a Edit page.
    It is working with out tappedpane, When I click Command link for Edit
    in TabbedPane, I am getting java script error saying "Error on page".
    When I submit the action from commandLink from an individulal page .
    Its working fine.
    anyone help me in resolving this issue...?

    Update your Ie, or maybe you have some option that the others don't have.

  • Command link navigation problems in IE but not firefox

    Hi,
    I've developed an application using JSF and SDO. I have several pages where the user is displayed data from the database and pages where the user can add data , edit data and delete data.
    Each page has a jsp fragment contained in the page. This is based on faces and is the naviation menu. Each link in the menu is a command link and has navigation rules which are global. Now the problem I get is that when I sometimes nvaigate between pages using the navigation or command links in a page the page just refreshes and displays the same page again. But if I keep trying to click the link again then after a few attempts the link goes to the page i've requested. I've added system outs on the actions for the links to see if they are getting called when the page just refreshes. The answer is no as the system out line is never printed unless the action of the link is actually executed.
    Now the problem is that this only occurs in ie and NOT in firefox. I'm really confused now!!
    Here is some techinical details to help narrow down my situation:
    I'm using wsad 5.1.2 which has faces 1.0, ie 6, firefox 1.0.3.
    Any help would be appreciated!!

    doh! i've solved this problem now....well for now its working perfectly but i'll have to do a bit more testing.
    For anyone that has this problem here was my solution...
    - In IE i went to tools > general tab > settings
    from this menu choose check for newer versions of stored pages to automatically. I previously had every visit to the page.
    This seems to have fixed my problem and the reason why it worked in firefox was because the settings for caching were different.

Maybe you are looking for