voyent
commandLink problem  XML
Forum Index -> Components
Author Message
rajkumar

Joined: 12/Jun/2006 00:00:00
Messages: 8
Offline


Hi,

I cannot get commandLink to work. This is what I have tried.

my jsp pages are in a sub directory inside WEB-INF pages, and when I try to link from page to another it simply refreshes the page.

The backing bean gets invoked but the page does not get forwarded, the redirects fail with a 404 error not found, when configured from faces-config.xml, what should i check any pointers please?

thanks in advance,
[Email]
rajkumar

Joined: 12/Jun/2006 00:00:00
Messages: 8
Offline


Some More Details, clicked post accidentally ...

I have a jsp page under the webapp directory from that root level I want to link to a page under the WEB-INF directory.

a) When using the actionListener the method gets invoked but using "FacesContext.getCurrentInstance().getExternalContext().dispatch("/WEB-INF/...");"
throws a null pointer exception at bridgestate ... some
java.lang.NullPointerException
at com.comp.ClassName(ClassName:<LineNumber>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
at javax.faces.component.UICommand.broadcast(UICommand.java:86)stack trace below

That basically returns the requestdispatcher as null I guess.

2) if I attempt to use the action attribute there are no errors on the out log, but trying to use redirect fails with a 404...

Any help is greatly appreciated.

Thank You,

raj,
[Email]
adnan.durrani


Joined: 19/Jan/2006 00:00:00
Messages: 437
Offline


Hi Raj,

Did you try to use "action" with navigation rule, this should fix your problem.

<ice:commandLink action="#{bean.url}" value="click me"/>

------Bean.url ----

public String url(){
if (...)
reutrn "this-url";
else
return "that-url";
}

----- faces-config.xml ---

<navigation-rule>
<description>Test link</description>
<from-view-id>/myPage.iface</from-view-id>
<navigation-case>
<from-outcome>that-url</from-outcome>
<to-view-id>/thatPage.iface</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>

Thanks,
-- Adnan Durrani --

-- Adnan Durrani --
[Email]
rajkumar

Joined: 12/Jun/2006 00:00:00
Messages: 8
Offline


Hi Adnan,

Thank you very much it worked.

regards
raj
[Email]
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team