You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Bruno Aranda - Dev <br...@ebiointel.com> on 2004/12/20 21:26:37 UTC

Programatically implementing a JsCookMenu: MethodBinding?

Hi,

I am creating a JsCookMenu that loads dinamically. It is there a way to
throw bind the action of a navigation item to a method using a
MethodBinding class? I see it can only accept String as parameter...

TIA

Bruno



Re: Jsf + Tiles integration under myfaces

Posted by BaTien Duong <ba...@dbgroups.com>.
Hello Matthias:

Thanks for your support. I will update you about my progress as we go 
along. Further information and the exception printout is below:


Matthias Wessendorf wrote:

> <>Hi BaTien, thanks for using MyFaces. My comments are intermixed Yes, 
> it seams that, for now you could not use a tile, that is refered by a 
> tile. Do you got any more info on that? 

>>    2.1) <h:commandButton> and <h:commandLink> are 
>>identically rendered 
>>(by looking at the page source - obviously with different 
>>component Ids) 
>>under the fragments of the page layout and fragments inserted 
>>by tiles. 
>>However, a click on <h:commandButton> and <h:commandLink> in the 
>>fragment inserted by tiles displays the same page. This means command 
>>actionListenner and action are skipped.
>>    
>>
>
>
>Have you tried navigation-rules without <from-view-id/> element:
>
><navigation-rule>
>  <navigation-case>
>    <from-outcome>myOutcome</from-outcome>
>    <to-view-id>/yetAnotherJSP.jsp</to-view-id>
>  </navigation-case>
></navigation-rule>
>
>Since your page is composed via Tiles you may use 
>*global* navigation rulez. Those rules are not
>specific to a special viewId (eg. myNavigationSite.jsp)
>
>  
>
Yes. I actually use global rule with and without
    <from-view-id>*</from-view-id>
Since my <servlet-mapping> is *.jsf so i use /yetAnotherJSP.jsf and 
myfaces tiles implementation translate into /jetAnotherJSP.tiles

>
>yes, that isn't using faces-config.xml for navigation
>
>  
>
>>This temporary solution goes against the 
>>reason why tiles is used in the first place.
>>    
>>
>>3) Using the temporary solution as explained in 2.3, i 
>>experiment with 
>>dynamically generated portal tabs. The servlet dispatcher 
>>consistently 
>>throw ClassCastException for the last tab, while the same thing under 
>>2.1 and 2.2 (i.e. jsf action and actionListener are NOT 
>>properly picked 
>>up) is stable and work properly. The root cause may then be 
>>the way how 
>>jsf is implemented. I hope this can be quickly patched and 
>>let us enjoy 
>>the fruit of Jsf + Tiles.
>>    
>>
>
>Could you please provide abit more of stracktrace
>for this case? 
>
>
>
>Thanks,
>Matthias
>
> 
>  
>
The exception is in the enclosed catalina.out

Our custom portal tabs is actually constructed based on myfaces examples 
with html myfaces dependencies removed. The layout is done at the last 
common portion for all tabs. The dynamic tabs are constructed with a 
placeholder of 8 tabs, out of which 4 tabs are actually generated. 
Exception is happened in the last tab if the page is generated without 
using tiles layout (i.e. use path rather than extends another tiles). As 
previously indicated, using tiles layout there is NO exception of the 
last tab. There is also no exception in the last tab, if i switch to a 
page that uses tiles layout before hitting the last tab. Also enclosed 
next is a summary of the exception.

*exception*

javax.servlet.ServletException: org.apache.jasper.JasperException
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)
	net.sourceforge.myfaces.custom.fileupload.MultipartFilter.doFilter(MultipartFilter.java:88)

*root cause*

javax.faces.FacesException: org.apache.jasper.JasperException
	net.sourceforge.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:414)
	net.sourceforge.myfaces.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:178)
	net.sourceforge.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:287)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
	net.sourceforge.myfaces.custom.fileupload.MultipartFilter.doFilter(MultipartFilter.java:88)

*note*

RE: Jsf + Tiles integration under myfaces

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
Hi BaTien,

thanks for using MyFaces. My comments are intermixed

> What shall i report following issue as a bug or a requested feature.
> 
> Issue:
> 
> Jsf + Tiles integration under myfaces works properly ONLY under the 
> first level of tiles definition and layout. Myfaces seems to skip jsf 
> phases after the first level.
> 
> A patch to make jsf implementation work properly at least in all 
> fragments of its generated html page will enable Jsf+Tiles as 
> a portal 
> rendering engine. Technically, tiles can be nested in any 
> level, so Jsf 
> + Tiles should be able to achieve this level of integration if the

Yes, it seams that, for now you could not use
a tile, that is refered by a tile. Do you
got any more info on that?

>     2.1) <h:commandButton> and <h:commandLink> are 
> identically rendered 
> (by looking at the page source - obviously with different 
> component Ids) 
> under the fragments of the page layout and fragments inserted 
> by tiles. 
> However, a click on <h:commandButton> and <h:commandLink> in the 
> fragment inserted by tiles displays the same page. This means command 
> actionListenner and action are skipped.


Have you tried navigation-rules without <from-view-id/> element:

<navigation-rule>
  <navigation-case>
    <from-outcome>myOutcome</from-outcome>
    <to-view-id>/yetAnotherJSP.jsp</to-view-id>
  </navigation-case>
</navigation-rule>

Since your page is composed via Tiles you may use 
*global* navigation rulez. Those rules are not
specific to a special viewId (eg. myNavigationSite.jsp)

>     2.2) I put a simple onclick Javascript to check if password and 
> confirmPassord identical. The onclick Javascript is executed, 
> but when 
> submitted the command action is ignored. This indicates that 
> jsf phases 
> are skipped.

Perhaps the same issue with this?

Btw. have you tried <x:validateEqual/> of MyFaces?
This enables you to confim passwords eg. 
(if you don't want JavaScript ;-))

>     2.3) <h:outputLink> dispatches to correct page under both 
> types of 
> fragments (layout fragment and tiles inserted fragment). This working 

yes, that isn't using faces-config.xml for navigation

> case makes me think a temporary workaround may be to use 
> <h:outputLink> 
> only in the portlet inserted tile fragment and any page that required 
> jsf actionListener, action will have a complete portal page 
> layout cut 
> and paste into it while waiting for a real solution of 
> properly rendring 
> Jsf components under tiles. This temporary solution goes against the 
> reason why tiles is used in the first place.

Yes, this goes against using Tiles


> 3) Using the temporary solution as explained in 2.3, i 
> experiment with 
> dynamically generated portal tabs. The servlet dispatcher 
> consistently 
> throw ClassCastException for the last tab, while the same thing under 
> 2.1 and 2.2 (i.e. jsf action and actionListener are NOT 
> properly picked 
> up) is stable and work properly. The root cause may then be 
> the way how 
> jsf is implemented. I hope this can be quickly patched and 
> let us enjoy 
> the fruit of Jsf + Tiles.

Could you please provide abit more of stracktrace
for this case? 



Thanks,
Matthias

 
> PS: If you are too busy, you can explain how jsf 
> implementation is done 
> and possible problems under tiles, and direct me to possible 
> sources to 
> resolve the issue.
> 
> Thanks
> 
> BaTien
> DBGROUPS
> 
> 
> 
> BaTien Duong wrote:
> 
> > Hello:
> >
> > Using myfaces-1.0.7, i was able create a complete dynamic 
> portal page
> > and tiles insertions of the display and portlet fragments. Each jsf 
> > page is a custom portal tab form.<h:commandButton> behaves normally 
> > within a portal page and can pick up correct action for a new page 
> > with new tiles fragments. However, within a fragment inserted by 
> > tiles, the <h:commandButton> does not pick up the command action.
> >
> > Investigations:
> >
> > (1) I tried both with and without the parent form and use / 
> or NOT use
> > parent form generation from myfaces. Results are the same.
> >
> > (2) Looking at the generated html from myfaces, i saw the generated
> > codes onclick for the <h:commandButton> that clears the old action 
> > form and supposely leads to the next navigation action. But this is 
> > not the case for the <h:commandButton> inside an inserted 
> tiles fragment.
> >
> > Possible solutions:
> >
> > (1) Is there any readily solution and/or quick fix for the above
> > issue? Even some direction to fix from source codes may help.
> >
> > (2) One possible solution may be to write a custom onclick attribute
> > for each <h:commandButton> within a tiles insertion, since myfaces 
> > will concatenate the custom onclick attribute with its generated 
> > javascript clear() function.
> >
> > Sory to post this in both dev and user lists.
> >
> > Thanks.
> >
> > BaTien
> > DBGROUPS
> >
> >
> 


Re: Jsf + Tiles integration under myfaces

Posted by BaTien Duong <ba...@dbgroups.com>.
Greetings: Matthias and other developers

What shall i report following issue as a bug or a requested feature.

Issue:

Jsf + Tiles integration under myfaces works properly ONLY under the 
first level of tiles definition and layout. Myfaces seems to skip jsf 
phases after the first level.

A patch to make jsf implementation work properly at least in all 
fragments of its generated html page will enable Jsf+Tiles as a portal 
rendering engine. Technically, tiles can be nested in any level, so Jsf 
+ Tiles should be able to achieve this level of integration if the 
rendering of jsf UI components are properly carried out. I hope this can 
be done quickly so a modern portal page under jsf + tiles can be out of 
the door. :-)

Prototype testings:

1) Using myfaces + tiles with JspTilesViewHandlerImpl of version 1.0.7, 
i created a portal page with 2 layouts: a portal page layout where tiles 
portlets are inserted in the 2 columns and a common display area, and a 
portlet layout that has common header menu and inserted tiles portlet 
contents. This is ok if portlet content has only jsp fragment. A mixture 
of jsf and jsp components will render the page in wrong order. This is a 
wellknown current issue between jsf and jsp. I solve the problem by 
using ONLY the portal page layout. Portlets are inserted directly as 
individual portlet tile fragment. Under this scenario, a portlet tile 
fragment can be presented as a normal jsf fragment.

2) Using normal jsf fragments under tiles portal page layout, i found 
jsf UI components behave normally in fragments of the page layout, but 
NOT in portlet fragments inserted by tiles. I try <h:commandButton>, 
<h:commandLink> and <h:outputLink>:

    2.1) <h:commandButton> and <h:commandLink> are identically rendered 
(by looking at the page source - obviously with different component Ids) 
under the fragments of the page layout and fragments inserted by tiles. 
However, a click on <h:commandButton> and <h:commandLink> in the 
fragment inserted by tiles displays the same page. This means command 
actionListenner and action are skipped.

    2.2) I put a simple onclick Javascript to check if password and 
confirmPassord identical. The onclick Javascript is executed, but when 
submitted the command action is ignored. This indicates that jsf phases 
are skipped.

    2.3) <h:outputLink> dispatches to correct page under both types of 
fragments (layout fragment and tiles inserted fragment). This working 
case makes me think a temporary workaround may be to use <h:outputLink> 
only in the portlet inserted tile fragment and any page that required 
jsf actionListener, action will have a complete portal page layout cut 
and paste into it while waiting for a real solution of properly rendring 
Jsf components under tiles. This temporary solution goes against the 
reason why tiles is used in the first place.

3) Using the temporary solution as explained in 2.3, i experiment with 
dynamically generated portal tabs. The servlet dispatcher consistently 
throw ClassCastException for the last tab, while the same thing under 
2.1 and 2.2 (i.e. jsf action and actionListener are NOT properly picked 
up) is stable and work properly. The root cause may then be the way how 
jsf is implemented. I hope this can be quickly patched and let us enjoy 
the fruit of Jsf + Tiles.

PS: If you are too busy, you can explain how jsf implementation is done 
and possible problems under tiles, and direct me to possible sources to 
resolve the issue.

Thanks

BaTien
DBGROUPS



BaTien Duong wrote:

> Hello:
>
> Using myfaces-1.0.7, i was able create a complete dynamic portal page 
> and tiles insertions of the display and portlet fragments. Each jsf 
> page is a custom portal tab form.<h:commandButton> behaves normally 
> within a portal page and can pick up correct action for a new page 
> with new tiles fragments. However, within a fragment inserted by 
> tiles, the <h:commandButton> does not pick up the command action.
>
> Investigations:
>
> (1) I tried both with and without the parent form and use / or NOT use 
> parent form generation from myfaces. Results are the same.
>
> (2) Looking at the generated html from myfaces, i saw the generated 
> codes onclick for the <h:commandButton> that clears the old action 
> form and supposely leads to the next navigation action. But this is 
> not the case for the <h:commandButton> inside an inserted tiles fragment.
>
> Possible solutions:
>
> (1) Is there any readily solution and/or quick fix for the above 
> issue? Even some direction to fix from source codes may help.
>
> (2) One possible solution may be to write a custom onclick attribute 
> for each <h:commandButton> within a tiles insertion, since myfaces 
> will concatenate the custom onclick attribute with its generated 
> javascript clear() function.
>
> Sory to post this in both dev and user lists.
>
> Thanks.
>
> BaTien
> DBGROUPS
>
>


Jsf + Tiles and

Posted by BaTien Duong <ba...@dbgroups.com>.
Hello:

Using myfaces-1.0.7, i was able create a complete dynamic portal page 
and tiles insertions of the display and portlet fragments. Each jsf page 
is a custom portal tab form.<h:commandButton> behaves normally within a 
portal page and can pick up correct action for a new page with new tiles 
fragments. However, within a fragment inserted by tiles, the 
<h:commandButton> does not pick up the command action.

Investigations:

(1) I tried both with and without the parent form and use / or NOT use 
parent form generation from myfaces. Results are the same.

(2) Looking at the generated html from myfaces, i saw the generated 
codes onclick for the <h:commandButton> that clears the old action form 
and supposely leads to the next navigation action. But this is not the 
case for the <h:commandButton> inside an inserted tiles fragment.

Possible solutions:

(1) Is there any readily solution and/or quick fix for the above issue? 
Even some direction to fix from source codes may help.

(2) One possible solution may be to write a custom onclick attribute for 
each <h:commandButton> within a tiles insertion, since myfaces will 
concatenate the custom onclick attribute with its generated javascript 
clear() function.

Sory to post this in both dev and user lists.

Thanks.

BaTien
DBGROUPS


Jsf + Tiles and

Posted by BaTien Duong <ba...@dbgroups.com>.
Hello:

Using myfaces-1.0.7, i was able create a complete dynamic portal page 
and tiles insertions of the display and portlet fragments. Each jsf page 
is a custom portal tab form.<h:commandButton> behaves normally within a 
portal page and can pick up correct action for a new page with new tiles 
fragments. However, within a fragment inserted by tiles, the 
<h:commandButton> does not pick up the command action.

Investigations:

(1) I tried both with and without the parent form and use / or NOT use 
parent form generation from myfaces. Results are the same.

(2) Looking at the generated html from myfaces, i saw the generated 
codes onclick for the <h:commandButton> that clears the old action form 
and supposely leads to the next navigation action. But this is not the 
case for the <h:commandButton> inside an inserted tiles fragment.

Possible solutions:

(1) Is there any readily solution and/or quick fix for the above issue? 
Even some direction to fix from source codes may help.

(2) One possible solution may be to write a custom onclick attribute for 
each <h:commandButton> within a tiles insertion, since myfaces will 
concatenate the custom onclick attribute with its generated javascript 
clear() function.

Sory to post this in both dev and user lists.

Thanks.

BaTien
DBGROUPS


Re: Programatically implementing a JsCookMenu: MethodBinding?

Posted by Thomas Spiegl <to...@apache.org>.
try this:
<x:navigationMenuItems value="#{yourBean.myMenu}" />

YourBean should provide the method:
public NavigationMenuItem[] getMyMenu {...}

use NavigationMenuItem.setNavigationMenuItems(NavigationMenuItem[] 
navigationMenuItems) to set menu-items children.

HTH, thomas



Bruno Aranda - Dev schrieb:

>Hi,
>
>I am creating a JsCookMenu that loads dinamically. It is there a way to
>throw bind the action of a navigation item to a method using a
>MethodBinding class? I see it can only accept String as parameter...
>
>TIA
>
>Bruno
>
>
>
>
>  
>