[solved] wrong value passed from url to injected bean

Splash Forums PrettyFaces Users [solved] wrong value passed from url to injected bean

Tagged: 

This topic contains 10 replies, has 2 voices, and was last updated by  Lincoln Baxter III 6 years, 9 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #17763

    djan
    Participant

    Hi all,

    i set up my application, built in icefaces, to use pretty faces. But i have following problem.

    i have managed bean defined like following:

    <managed-bean>

    <managed-bean-name>ControllerBean</managed-bean-name>

    <managed-bean-class>com.test.ControllerBean</managed-bean-class>

    <managed-bean-scope>session</managed-bean-scope>

    </managed-bean>

    ControllerBean class looks like following:

    public class ControllerBean {

    private String id;

    //getter, setter for id property

    }

    then i have following rule in my pretty-config.xml

    <url-mapping id=”detail”>

    <pattern value=”/Item/#{ControllerBean.id}”/>

    <view-id>/pages/ItemDetailPage.iface</view-id>

    </url-mapping>

    and my problem:

    i’m navigating to this page via standard action navigation. e.g. like following:

    public String linkAction() {

    getBean(“ControllerBean”).setId(3);

    return “pretty:detail”;

    }

    the page is displayed correctly and also the url is correct, but when i edit url in the web browser e.g. from /Item/3 to /Item/5 method ControllerBean.setId receives value 3 anyway.

    what is wrong in my solution?

    thanx for any hint

    #20046

    When you edit the URL, are you pressing enter afterwards? If not, the value has not been sent to the server yet. Changing the URL only affects server state if the request is made by submitting the URL.

    E.g: Changing the URL does not change anything else on the page. So if you submit a form or click a link on the page, the old URL will still be in the HTML source..

    #20047

    djan
    Participant

    yes, i’m definitely pressing enter key to submit url modification :).

    #20048

    djan
    Participant

    one more remark.

    when i paste url ‘/Item/5’ into browser address bar, currently visiting different page, id parameter is handled and passed correctly. my problem occurs only, when i’m on page with url /Item/<id> and i modify this <id> value

    #20049

    Are you using IceFaces? Can you send a sample app that reproduces this issue?

    Thanks.

    #20050

    What version of PrettyFaces, JSF, IceFaces, and which server/version are you using?

    #20051

    djan
    Participant

    yes, it is an icefaces application running on glassfish app server. i created simple application with the same behavior. What is your email address?

    #20052

    djan
    Participant

    PrettyFaces 3.0.1, JSF 1.2, IceFaces 1.8.2 and glassfish 2.1.1

    #20053
    #20054

    Hey David,

    I hate to say this, but I got your app working, and this is definitely a question you’re going to need to ask on the IceFaces forums; there is nothing wrong with your PrettyFaces configuration.

    The application is intercepting changes to the URL and doing some pretty crazy AJAX/Server-side state manipulation. This is what I meant by “IceFaces does a lot of very bad things.”

    You’ll have to ask them. I’m sorry for making you wait so long for a not-very-helpful answer. I would think there should be a way to disable this in IceFaces, but… I’m no expert there.

    Sorry,

    –Lincoln

    #20055

    Until then, you may be able to work around the problem by using Named Path Parameters:

    http://ocpsoft.com/docs/prettyfaces/snapshot/en-US/html_single/#config.pathparams.named

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

Comments are closed.