Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Problem With Result Mapping

  1. #1
    Join Date
    Jan 2008
    Posts
    4

    Smile Problem With Result Mapping

    hi, everybody
    i m using result mapping.but it always gives error while setting values for ${id} in query string.



    <object type="~/user/myfriendlist.aspx">
    <property name="Frienddao" ref="friends">

    </property>
    <property name="Usr" ref="UserData">

    </property>
    <property name="Results">
    <dictionary>
    <entry key="ProfileId" value="transferrofile.aspx?cid=${Id}"/>
    </dictionary>
    </property>


    </object>

    i am setting value for Id by exposing property
    String Id
    {
    get{}
    set{}

    }
    on my page friendlist.aspx from where i have to redirect to profile page depending upon selected id.

    I have no clue to solve this problem. i really dont know from where to set its value.

    Any help will be appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    what is the exact error you are getting?

    There is a problem when using a PropertyPlaceHolderConfigurer in the same context since unfortunately both, resultmapping and the configurer, are using the same delimiters ('${' and '}') for replacing values. In this case try using another delimiter for your PropertyPlaceHolderConfigurer by explicitely settings it's PlaceholderPrefix and PlaceholderSuffix property.

    cheers,
    Erich

  3. #3
    Join Date
    Jan 2008
    Location
    Canberra, Australia
    Posts
    4

    Default

    Quote Originally Posted by Erich Eichinger View Post
    Hi,

    what is the exact error you are getting?

    There is a problem when using a PropertyPlaceHolderConfigurer in the same context since unfortunately both, resultmapping and the configurer, are using the same delimiters ('${' and '}') for replacing values. In this case try using another delimiter for your PropertyPlaceHolderConfigurer by explicitely settings it's PlaceholderPrefix and PlaceholderSuffix property.

    cheers,
    Erich
    HI Eric,

    I am getting the same problem, and my message is "Could not resolve placeholder 'FieldNameX' ".

    At this time, I dont know yet if I have made the mistake or if the framework has a bug.

    However, I think if there is a problem with the Results Mapping capability, then may I suggest that it is a critical problem because page flow is a central process to any web application.

    thanks, paul.

  4. #4
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    you are right. But since this is a major breaking change, we didn't do it yet. Furthermore it doesn't happen very often, only in conjunction with a PropertyPlaceholderConfigurer and is very easy to workaround.

    Can you maybe post some sample code reproducing your pb?

    cheers,
    Erich

  5. #5
    Join Date
    Jan 2008
    Posts
    4

    Default

    hi erich,
    my code is
    public partial class user_myfriendlist : Page
    {
    protected Int32 id;
    public Int32 Id
    {
    get { return id; }
    set { id = value; }
    }

    protected void grdfFriendList_RowCommand(object sender,GridViewCommandEventArgs e)
    {
    if (e.CommandName == "Send")
    {

    this.id = Convert.ToInt32(e.CommandArgument.ToString());
    SetResult("ProfileId");
    }
    }


    and code for web.xml file is

    <object type="~/user/myfriendlist.aspx">
    <property name="Frienddao" ref="friends">

    </property>
    <property name="Usr" ref="UserData">

    </property>


    <property name="Results">
    <dictionary>

    <entry key="ProfileId" ref="Profile"/>
    </dictionary>
    </property>



    </object>


    <object id="Profile" type="Spring.Web.Support.Result, Spring.Web">
    <property name="TargetPage" value="~/user/profile.aspx"/>
    <property name="Mode" value="Redirect"/>
    <property name="Parameters">
    <dictionary>
    <entry key="Id" ref="${Id}"/>
    </dictionary>
    </property>
    </object>


    when i run my application ,i get error

    can't resolve placeholder Id

    if u can post example of using query String having complete detail .it will be highly appreciated.

    Thanks for Your Response.
    Last edited by mohit.jangra; 02-01-2008 at 09:02 AM.

  6. #6
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    your config looks ok. You still owe me your stacktrace ;-)

    R u sure, you didn't define a PropertyPlaceholderConfigurer in your context configuration?

    -Erich

  7. #7
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    btw: I just committed a fix, allowing for optionally using the %{ prefix in result mapping:

    Thus instead of using ${ you can write

    Code:
    <property name="Parameters">
          <dictionary>
            <entry key="Id" ref="%{Id}"/>
          </dictionary>
    </property>
    This avoids prefix clashing with the PropertyPlaceholderConfigurer. You can get the latest fix with the next nightly build.

    cheers,
    Erich

  8. #8
    Join Date
    Jan 2008
    Location
    Canberra, Australia
    Posts
    4

    Default

    Quote Originally Posted by Erich Eichinger View Post
    Hi,

    you are right. But since this is a major breaking change, we didn't do it yet. Furthermore it doesn't happen very often, only in conjunction with a PropertyPlaceholderConfigurer and is very easy to workaround.

    Can you maybe post some sample code reproducing your pb?

    cheers,
    Erich
    HI Eric,

    I am not sure about that. I think that it would be a common problem because using PropertyPlaceholderConfigurer and a Result Mapping object expression together would be common. They are both good features and I had immediately tried to use both in my setup.

    However, I don't think the problem was either Spring or my configuration, but rather it might simply be a documentation issue. I have been following the Spring Framework Reference Documentation and both items are explained reasonably well. And hence I decieded to use them. However the conflicting use of both at the same time is not explained.

    May I suggest updating the documentation would help. My main concern is when simple "bread and butter" features appear broken to the new user, they might quickly loose confidence in the framework.

    I found a similar situation with the nHibernate lazy initialisation attribute when using Spring.Web bidirection databinding. It did not work and I had been following the documentation. I was a little perturbed. But, once I had found the configuration conflict I was OK of course. Once again, a discussion of the correct setup in the Reference documentation would have helped.

    Of course, Spring.NET is brilliant. I would hate to see newbies put off it because of some silly little configuration conflicts. So this is my 2c.

    thanks

    paul.

  9. #9
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    thank you for your feedback. We really appreciate it and will update the documentation accordingly as u suggested.

    What was the issue with NHibernate configuration conflict?

    cheers,
    Erich

  10. #10
    Join Date
    Jan 2008
    Location
    Canberra, Australia
    Posts
    4

    Default

    Hi Eric,

    What I meant to say is that the documentation could very well mention the following configuration issues - given that I at least, believe that they are very common problems that anyone will encounter.

    1. Firstly, the issues discussed in this thread - using PropertyPlaceholderConfigurer and a Result Mapping object expression together could be explained.

    However, your change to allow the %{ prefix tag is excellent. Maybe that could be the new default behavior (for the next release), and hence the problem goes away.

    2. Another common issue, might be the one discussed here regarding the use of the NHibernate lazy initialisation attribute when also using Spring.Web bidirectional databinding on a web page.

    See http://forum.springframework.net/arc...hp/t-1232.html

    This problem certainly occurred for me, and I was simply trying to follow the basic setup for binding and NHibernate as specified in the Reference documentation.

    Thanks

    paul.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •