You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Ian.Priest" <Ia...@opsera.com> on 2006/05/04 10:19:39 UTC

[shale][clay] commandLink in dataTable not working

 
This is driving me mad - can anyone see why my command link isn't
working?
I have a table that lists customers and has an action link in each row
to view customer details. I build all my viws using clay. The clay
components are:

<component jsfid="userSearchTable" extends="dataTable"
allowBody="false">
	<attributes>
		<set name="value"
value="#{@managed-bean-name.customers}" />
		<set name="var" value="customer" />
	</attributes>

	<element renderId="0" jsfid="userNameColumn" />
	<element renderId="1" jsfid="firstNameColumn" />
	<element renderId="2" jsfid="lastNameColumn" />
	<element renderId="3" jsfid="emailColumn" />
</component>

<component jsfid="userNameColumn" extends="column" id="screenName">

	<element renderId="0" jsfid="outputText" facetName="header">
		<attributes>
			<set name="value"
value="#{messages['@managed-bean-name.usernamecol.header']}" />
		</attributes>
	</element>

	<element renderId="1" jsfid="commandLink" id="link">
		<attributes>
			<set name="action" value="showUser" />
			<set name="actionListener"
value="#{@managed-bean-name.showUser" />
		</attributes>

		<element renderId="10" jsfid="outputText">
			<attributes>
				<set name="value"
value="#{customer.user.username}" />
			</attributes>
		</element>

		<element renderId="11" jsfid="param" id="customerId">
			<attributes>
				<set name="name" value="id" />
				<set name="value" value="#{customer.id}"
/>
			</attributes>
		</element>
	</element>
</component>

I've set up faces config like this...

<navigation-rule>
	<from-view-id>/admin/*</from-view-id>
	<navigation-case>
		<from-outcome>showUser</from-outcome>
		<to-view-id>/admin/showuser.html</to-view-id>
		<redirect/>
	</navigation-case>
</navigation-rule>

And my action listener method is just this for now...

	public void showUser(ActionEvent event) {
		logger.debug("Entered showUser");
		
		UIParameter component = (UIParameter)
event.getComponent().findComponent("customerId");
		long id =
Long.parseLong(component.getValue().toString());

		logger.debug("id = " + id);
	}


The table appears to render ok, but when I click on the link the
actionListener method isn't called and my navigation rule is ignored.
(Actually the page with the table goes back to itself, which suggests
the app is seeing null as the outcome of the click). 
There are no errors logged. I've even deliberately mis-typed the name of
the actionListener method in the clay-config file and it still didn't
throw an exception, so I'm pretty sure it's not trying to call it!

I'm a bit stuck as to what else to look for to fix it, so all hints and
tips are welcome!

Cheers,
Ian.
 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [shale][clay] commandLink in dataTable not working

Posted by Alberto Molpeceres <al...@gmail.com>.
I don't know if this applies since I've never used Clay, but when you
have this lind of problem in JSF, 95% of the times if because you
forgot to declare the form. CommandLinks doesn't work if not inside of
a form.

   al.

On 5/4/06, Ian.Priest <Ia...@opsera.com> wrote:
>
> This is driving me mad - can anyone see why my command link isn't
> working?
> I have a table that lists customers and has an action link in each row
> to view customer details. I build all my viws using clay. The clay
> components are:
>
> <component jsfid="userSearchTable" extends="dataTable"
> allowBody="false">
>         <attributes>
>                 <set name="value"
> value="#{@managed-bean-name.customers}" />
>                 <set name="var" value="customer" />
>         </attributes>
>
>         <element renderId="0" jsfid="userNameColumn" />
>         <element renderId="1" jsfid="firstNameColumn" />
>         <element renderId="2" jsfid="lastNameColumn" />
>         <element renderId="3" jsfid="emailColumn" />
> </component>
>
> <component jsfid="userNameColumn" extends="column" id="screenName">
>
>         <element renderId="0" jsfid="outputText" facetName="header">
>                 <attributes>
>                         <set name="value"
> value="#{messages['@managed-bean-name.usernamecol.header']}" />
>                 </attributes>
>         </element>
>
>         <element renderId="1" jsfid="commandLink" id="link">
>                 <attributes>
>                         <set name="action" value="showUser" />
>                         <set name="actionListener"
> value="#{@managed-bean-name.showUser" />
>                 </attributes>
>
>                 <element renderId="10" jsfid="outputText">
>                         <attributes>
>                                 <set name="value"
> value="#{customer.user.username}" />
>                         </attributes>
>                 </element>
>
>                 <element renderId="11" jsfid="param" id="customerId">
>                         <attributes>
>                                 <set name="name" value="id" />
>                                 <set name="value" value="#{customer.id}"
> />
>                         </attributes>
>                 </element>
>         </element>
> </component>
>
> I've set up faces config like this...
>
> <navigation-rule>
>         <from-view-id>/admin/*</from-view-id>
>         <navigation-case>
>                 <from-outcome>showUser</from-outcome>
>                 <to-view-id>/admin/showuser.html</to-view-id>
>                 <redirect/>
>         </navigation-case>
> </navigation-rule>
>
> And my action listener method is just this for now...
>
>         public void showUser(ActionEvent event) {
>                 logger.debug("Entered showUser");
>
>                 UIParameter component = (UIParameter)
> event.getComponent().findComponent("customerId");
>                 long id =
> Long.parseLong(component.getValue().toString());
>
>                 logger.debug("id = " + id);
>         }
>
>
> The table appears to render ok, but when I click on the link the
> actionListener method isn't called and my navigation rule is ignored.
> (Actually the page with the table goes back to itself, which suggests
> the app is seeing null as the outcome of the click).
> There are no errors logged. I've even deliberately mis-typed the name of
> the actionListener method in the clay-config file and it still didn't
> throw an exception, so I'm pretty sure it's not trying to call it!
>
> I'm a bit stuck as to what else to look for to fix it, so all hints and
> tips are welcome!
>
> Cheers,
> Ian.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org