jsf messed up links

Posted by Mateusz on Stack Overflow See other posts from Stack Overflow or by Mateusz
Published on 2012-11-20T22:21:39Z Indexed on 2012/11/20 23:01 UTC
Read the original article Hit count: 265

Filed under:
|
|
|
|

I'm new to JSF. My application is working, but I'm confused with links in browser when using controller. BTW, there is also PrimeFaces in my app so don't be suprised with p: tags. Let's say I have 'list' and 'show' pages with controller doing redirection between them. First I'm on http://localhost:8080/y/r/conversation/list.xhtml page. There is link created with line <p:commandLink action="#{lazyConversationBean.doShow(conv)}" ajax="false" value="View"/>. lazyConversationBean acts here as my Controller. There is method:

public String doShow(Conversation c) {
    this.setSelectedConversation(c);
    return "view";
}

from which I got redirected to ...... again http://localhost:8080/y/r/conversation/list.xhtml (browser shows it) even when it's correct http://localhost:8080/y/r/conversation/view.xhtml page. There I have link <p:commandButton action="#{lazyConversationBean.doList()}" ajax="false" value="Back to list"/> and again controller has method:

public String doList() {
    return "list";
}

from which I got redirected to ... yeah, you guessed right ... http://localhost:8080/y/r/conversation/view.xhtml (that is again what browser shows) even when again it is correct http://localhost:8080/y/r/conversation/list.xhtml page.

It seams as browser link area is always one step behind page currently being displayed. I don't even know if it's some incorrect behaviour as I have no idea how to query google for this :D Just for test I did this short tutorial, where netbeans created whole stack of code on one of my entities, and behaviour was the same, so it's not PrimeFaces magic related.

Can you tell my why it happens, and how to fix it? Users likes to copy correct links ;)

© Stack Overflow or respective owner

Related posts about jsf

Related posts about browser