You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Do...@percussion.com on 2005/11/29 23:27:51 UTC

Newbie problem with actions and actionListeners

Hi,

I did try the FAQ and a google search, but didn't find anything 
immediately obvious. I had written one small example using the RI version 
of JSF, which works correctly. Now I'm running the latest MyFaces, 1.1.1, 
with JBoss 4.0.2. The output of the JSP works fine, but no navigation 
works. This includes the firing of actions and actionListeners and also 
page navigation in general. I'm guessing that the lack of navigation 
behavior is the root of my problem since my managed bean is clearly found.

While I wouldn't mind having someone answer this, I'm quite content with 
just having a notion of how to go about debugging the problem. It's 
entirely clear to me that this has to be my error as myfaces wouldn't be 
useful if this didn't work.

Regards,
Doug
-------------------------------------------------
Details:

I tried diagnosing by setting some log4j properties in the log4j.xml file:

        <category name="org.apache.myfaces.el.VariableResolverImpl">
                <priority value="ALL"/>
        </category>

        <category 
name="org.apache.myfaces.application.NavigationHandlerImpl">
                <priority value="ALL"/>
        </category>

        <category name="javax.faces.webapp.FacesServlet">
                <priority value="ALL"/>
        </category>

        <category name="org.apache.myfaces.lifecycle.LifecycleImpl">
                <priority value="ALL"/>
        </category>

I was hoping one of these would spit out something useful. Nothing extra 
came out.  The actions defined in the managed bean are public and defined 
correctly. Here's an example for newlist:

   /**
    * Action that is fired if a new list should be created
    * @return the name of the outcome
    */
   public String newlist()
   {
      IPSPublisherService pub = 
PSPublisherServiceLocator.getPublisherService();
      m_current = pub.createContentList("newlist"); 
      return "edit";
   }

Here's the faces-config file. Note that I tried navigating from 
listcontentlists and editcontentlist both, and neither worked. I'm 
assuming I need the entire context path of the jsp in the from and to view 
ids. 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer 
Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config >
        <navigation-rule>
 <from-view-id>/ui/contentlist/listcontentlists.jsp</from-view-id>
                <navigation-case>
                        <from-outcome>edit</from-outcome>
 <to-view-id>/ui/contentlist/editcontentlist.jsp</to-view-id>
                </navigation-case>
                <navigation-case>
                        <from-outcome>newlist</from-outcome>
 <to-view-id>/ui/contentlist/editcontentlist.jsp</to-view-id>
                </navigation-case>
                <navigation-case>
                        <from-outcome>delete</from-outcome>
 <to-view-id>/ui/contentlist/listcontentlists.jsp</to-view-id>
                </navigation-case> 
        </navigation-rule>
        <navigation-rule>
 <from-view-id>/ui/contentlist/editcontentlist.jsp</from-view-id>
                <navigation-case>
                        <from-outcome>save</from-outcome>
 <to-view-id>/ui/contentlist/listcontentlists.jsp</to-view-id>
                </navigation-case>
                <navigation-case>
                        <from-outcome>cancel</from-outcome>
 <to-view-id>/ui/contentlist/listcontentlists.jsp</to-view-id>
                </navigation-case> 
        </navigation-rule>
 
        <managed-bean>
                <managed-bean-name>contentlist</managed-bean-name>
 
<managed-bean-class>com.percussion.services.publisher.ui.PSContentListSelect</managed-bean-class>
                <managed-bean-scope>session</managed-bean-scope>
                <managed-property>
                        <property-name>current</property-name>
                        <null-value />
                </managed-property>
                <managed-property>
                        <property-name>sortBy</property-name>
                        <value>name</value>
                </managed-property>
        </managed-bean>
</faces-config>

Here's the list jsp:

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://rhythmyx.percussion.com/components"
        prefix="rxcomp"%>
<%String path = request.getContextPath();
         String basePath = request.getScheme() + "://"
               + request.getServerName() + ":" + request.getServerPort() + 
path
               + "/";
  String sortBy = request.getParameter("sortBy");
  String pagename = sortBy != null && sortBy.equals("id") ? 
"pub_contentlistsbyid" : "pubcontentlistsbyname";
%>
<html>
<f:view>
        <head>
        <base href="<%=basePath%>ui/contentlist">

        <link href="../sys_resources/css/templates.css" rel="stylesheet"
                type="text/css">
        <link href="../rx_resources/css/templates.css" rel="stylesheet"
                type="text/css">
        <script src="../sys_resources/js/formValidation.js"
                type="text/javaScript"></script>

        <title>Rhythmyx - Publishing Administrator</title>

        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
        </head>
        <body leftmargin="0" marginheight="0" marginwidth="0" 
topmargin="0">
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
                <tr>
                        <td colspan="2"></td>
                </tr>
                <tr>
                        <td></td>
                        <td align="left" valign="top" 
class="outerboxcell">
                        <table width="100%" height="100%" cellpadding="0" 
cellspacing="0"
                                border="0">
                                <tr>
                                        <td class="outerboxcell" 
align="right" valign="top"><span
 class="outerboxcellfont">Content List Administration</span></td>
                                </tr>
                                <tr>
                                        <td class="outerboxcell" 
align="left"><h:form
                                                id="selectcontentlist">
                                                <h:inputHidden id="sortBy" 
value="#{entry.sortBy}" />
                                                <t:dataTable 
rendered="true" first="0" rows="20" width="100%"
                                                        cellpadding="0" 
cellspacing="1" headerClass="headercell"
 rowClasses="datacell1,datacell2"
 value="#{contentlist.entries}" var="entry">
                                                        <t:column 
width="25" styleClass="datacell1font">
 <h:commandLink action="#{entry.delete}">
 <t:graphicImage value="/sys_resources/images/delete.gif"
 border="false" />
 </h:commandLink>
                                                        </t:column>
                                                        <t:column 
width="20%" styleClass="datacell1font">
                                                                <f:facet 
name="header">
 <t:outputLabel styleClass="headercell2font" value="Name" />
                                                                </f:facet>
 <h:commandLink action="#{entry.edit}">
 <h:outputText value="#{entry.name}" />
 </h:commandLink>
                                                        </t:column>
                                                        <t:column 
styleClass="datacell1font">
                                                                <f:facet 
name="header">
 <t:outputLabel styleClass="headercell2font" value="Url" />
                                                                </f:facet>
 <h:outputText value="#{entry.url}" />
                                                        </t:column>
                                                        <t:column 
width="10%" style="text-align: center"
 styleClass="datacell1font">
                                                                <f:facet 
name="header">
 <t:outputLabel styleClass="headercell2font"
 value="Edition Type" />
                                                                </f:facet>
 <h:graphicImage
 value="/sys_resources/images/#{entry.editionTypeIcon}"></h:graphicImage>
                                                        </t:column>
                                                </t:dataTable>
                                        </td>
                                </tr>
                        </table>
                        <div style="padding: 10px"><h:commandButton 
value="New Content List"
                                action="#{contentlist.newlist}" /></div>
                        </h:form></td>
                </tr>
        </table>
        </body>
</f:view>
</html>

Re: Newbie problem with actions and actionListeners

Posted by Do...@percussion.com.
Your are correct - I'm getting a conversion error. I guess that qualifies 
as something to work on. Thanks very much.

Doug




Mike Kienenberger <mk...@gmail.com> 
11/29/2005 05:45 PM
Please respond to
"MyFaces Discussion" <us...@myfaces.apache.org>


To
MyFaces Discussion <us...@myfaces.apache.org>
cc

Subject
Re: Newbie problem with actions and actionListeners






You should still stick a message tag on and check the values.   Conversion 
might be failing even if there's no validating going on.

On 11/29/05, Doug_Rand@percussion.com < Doug_Rand@percussion.com> wrote:

No, the action methods are not being invoked at all. I have no validation 
configured (yet) for my 
pages since I'm still stuck on this simpler problem. 

Thanks, 
Doug 



Simon Kitching <sk...@obsidium.com> 
11/29/2005 05:41 PM 

Please respond to
"MyFaces Discussion" <us...@myfaces.apache.org>



To
MyFaces Discussion <us...@myfaces.apache.org> 
cc

Subject
Re: Newbie problem with actions and actionListeners








Doug_Rand@percussion.com wrote:
> 
> Hi,
> 
> I did try the FAQ and a google search, but didn't find anything 
> immediately obvious. I had written one small example using the RI 
> version of JSF, which works correctly. Now I'm running the latest 
> MyFaces, 1.1.1, with JBoss 4.0.2. The output of the JSP works fine, but 
> no navigation works. This includes the firing of actions and 
> actionListeners and also page navigation in general. I'm guessing that 
> the lack of navigation behavior is the root of my problem since my 
> managed bean is clearly found.

Are your action methods being invoked (ie do logging statements in them 
generate output)? If not, one cause can be validation failure; I was 
stuck on that for a while where a page would always just "refresh". 
Adding an <h:messages> tag to the page revealed the problem. I can't see 
any validation configured for your jsp page though.

Regards,

Simon



Re: Newbie problem with actions and actionListeners

Posted by Mike Kienenberger <mk...@gmail.com>.
You should still stick a message tag on and check the values.   Conversion
might be failing even if there's no validating going on.

On 11/29/05, Doug_Rand@percussion.com <Do...@percussion.com> wrote:
>
>
> No, the action methods are not being invoked at all. I have no validation
> configured (yet) for my
> pages since I'm still stuck on this simpler problem.
>
> Thanks,
> Doug
>
>
>
>  *Simon Kitching <sk...@obsidium.com>*
>
> 11/29/2005 05:41 PM  Please respond to
> "MyFaces Discussion" <us...@myfaces.apache.org>
>
>   To
> MyFaces Discussion <us...@myfaces.apache.org>  cc
>
>  Subject
> Re: Newbie problem with actions and actionListeners
>
>
>
>
>
>
> Doug_Rand@percussion.com wrote:
> >
> > Hi,
> >
> > I did try the FAQ and a google search, but didn't find anything
> > immediately obvious. I had written one small example using the RI
> > version of JSF, which works correctly. Now I'm running the latest
> > MyFaces, 1.1.1, with JBoss 4.0.2. The output of the JSP works fine, but
> > no navigation works. This includes the firing of actions and
> > actionListeners and also page navigation in general. I'm guessing that
> > the lack of navigation behavior is the root of my problem since my
> > managed bean is clearly found.
>
> Are your action methods being invoked (ie do logging statements in them
> generate output)? If not, one cause can be validation failure; I was
> stuck on that for a while where a page would always just "refresh".
> Adding an <h:messages> tag to the page revealed the problem. I can't see
> any validation configured for your jsp page though.
>
> Regards,
>
> Simon
>
>

Re: Newbie problem with actions and actionListeners

Posted by Do...@percussion.com.
No, the action methods are not being invoked at all. I have no validation 
configured (yet) for my 
pages since I'm still stuck on this simpler problem.

Thanks,
Doug




Simon Kitching <sk...@obsidium.com> 
11/29/2005 05:41 PM
Please respond to
"MyFaces Discussion" <us...@myfaces.apache.org>


To
MyFaces Discussion <us...@myfaces.apache.org>
cc

Subject
Re: Newbie problem with actions and actionListeners






Doug_Rand@percussion.com wrote:
> 
> Hi,
> 
> I did try the FAQ and a google search, but didn't find anything 
> immediately obvious. I had written one small example using the RI 
> version of JSF, which works correctly. Now I'm running the latest 
> MyFaces, 1.1.1, with JBoss 4.0.2. The output of the JSP works fine, but 
> no navigation works. This includes the firing of actions and 
> actionListeners and also page navigation in general. I'm guessing that 
> the lack of navigation behavior is the root of my problem since my 
> managed bean is clearly found.

Are your action methods being invoked (ie do logging statements in them 
generate output)? If not, one cause can be validation failure; I was 
stuck on that for a while where a page would always just "refresh". 
Adding an <h:messages> tag to the page revealed the problem. I can't see 
any validation configured for your jsp page though.

Regards,

Simon


Re: Newbie problem with actions and actionListeners

Posted by Simon Kitching <sk...@obsidium.com>.
Doug_Rand@percussion.com wrote:
> 
> Hi,
> 
> I did try the FAQ and a google search, but didn't find anything 
> immediately obvious. I had written one small example using the RI 
> version of JSF, which works correctly. Now I'm running the latest 
> MyFaces, 1.1.1, with JBoss 4.0.2. The output of the JSP works fine, but 
> no navigation works. This includes the firing of actions and 
> actionListeners and also page navigation in general. I'm guessing that 
> the lack of navigation behavior is the root of my problem since my 
> managed bean is clearly found.

Are your action methods being invoked (ie do logging statements in them 
generate output)? If not, one cause can be validation failure; I was 
stuck on that for a while where a page would always just "refresh". 
Adding an <h:messages> tag to the page revealed the problem. I can't see 
any validation configured for your jsp page though.

Regards,

Simon