Re: [Stripes-users] Problem with value binding

Subject:   Re: [Stripes-users] Problem with value binding (find more)
From:   Tim Fennell <hidden> (find more)
Date:   Jan 20, 2006 11:19

Hi Florian,

Let me see if I can help....

On Jan 20, 2006, at 11:00 AM, Florian Falkner wrote:

> I got a problem with stripes' value binding. If I want to edit an  
> existing
> record, the current values are not set in the HTML Tags.
>
> I used the following approach:
>
> Snippet of user jsp Site:
> <td align="left" width="400">
> <stripes:text size="25" class="normalInput" name="lastname"/></td>
> <td align="left" width="100" class="textBold">Firstname/td>
> <td align="left" width="400">
> <stripes:text  class="normalInput" name="firstname"/>
> </td>
>
> With a bean wich initializes the data to display with the following  
> method:
> @DontValidate
> @HandlesEvent("InitEditCaller")
> public Resolution initEditCaller() {
>       currentCaller = getContext().getSelectedCalller();
>       service.lock(currentCaller);
>       return new ForwardResolution("createCaller.jsp");
> }
>
> The current caller is extracted from session and set in the bean,  
> which has
> delegate Methods for the needed properties.
This is indeed pretty odd.  On a side note (though probably not  
related to your problem) Stripes is quite happy working with nested  
properties, so there's no need to add delegate methods to the  
ActionBean.  You can just use <stripes:text name="caller.lastname"/>  
and Stripes will manage the rest...

The only thing I can think of that might be causing this is if the  
request contains parameters called 'firstname' and 'lastname' that  
are empty Strings.  By default Stripes will look for values first in  
the request parameters, then in the ActionBean and lastly in the JSP/
tag itself.  So if there were request parameters with matching names  
that could cause your problem.  If this is not the case then I'm not  
sure what else it could be.

> Another less important thing I noticed, is that <stripes:errors>  
> only works
> out! of a <stripes:form> element, otherwise no errors are displayed.
The behaviour of <stripes:errors> is
   - if nested in a form, only display errors generated by that form
   - if not nested in a form, display *any* errors present

Does this description make sense of what you are seeing?  If not,  
could you please open a JIRA bug and provide more information?

> Furthermore the stylesheets aren't changed when an validation error  
> occured,
> but the validation is made.
I'm not sure I understand.  Is it the case that you have a validation  
error, the validation error displays, but field does not get the css  
class 'error'?

> The layout of the JSP is rather complex, with nested <layout-
> components> and
> <layout-render> elements. The mentioned <stripes:text> input fields  
> are all
> located in a component, which is loaded into the layout.
Hmm.  There is one other thing that I can think of.  There used to be  
a requirement in Stripes that input tags all be nested inside a form  
tag.  That caused problems with spreading tags around in layouts, so  
a change was made to use a tag-stack maintained inside of Stripes.   
If somehow the text tags are getting evaluated before the opening  
form tag or after the close form tag (even if they end up inside the  
form tag in HTML), this could cause problems.  For example, to find  
out if they are in error the Stripes input tags delegate to their  
form tag to find errors.  They also use the form tag to find the  
ActionBean (and hence to populate their values).  This sounds like a  
promising area to look at as it would explain perhaps even all three  
of the problems you are seeing.

If you can I would add some logging statements to your various layout  
components and see if you can discern the order in which they are  
evaluated, and if it makes sense.  If you have no luck, let me know  
what you do find out and I'll see if I can think of anything else.

-t





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Stripes-users mailing list
hidden
https://lists.sourceforge.net/lists/listinfo/stripes-users
Entire Thread (Showing 3 of 3)

  • [Stripes-users] Problem with value binding Florian Falkner <hidden>

    Hello, I got a problem with stripes' value binding. If I want to edit an existing record, the current values are not set in the HTML Tags

    • Re: [Stripes-users] Problem with value binding Tim Fennell <hidden>

      • Re: [Stripes-users] Problem with value binding Florian Falkner <hidden>

        Hi Tim! First thanks for your quick answer, it brought me on the right track, that there is something wrong with my form elements. I've found the error it was not Stripes' fault