You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Robert Zeigler <rd...@u.arizona.edu> on 2004/03/23 21:55:32 UTC

Form rewinding and updating properties

Hi,

I'm pretty new to tapestry and still trying to get the hang of the 
"tapestry way" of doing things.
I've got a page that lists out student information (student's name, etc. 
as well as updatable information about the courses a student is enrolled in,
section, status, etc.). I've got the page so that it loads correctly, 
finally, but if I try updating the information, I get an ognl exception:

Unable to update expression 'course.currentSection' for 
org.eledge.sms.pages.ViewStudent$Enhance_307@169c9a2[ViewStudent] to null.
binding: 	ExpressionBinding[ViewStudent course.currentSection]
location: 	context:/WEB-INF/ViewStudent.page, line 56, column 67
 


ognl.OgnlException
target is null for setProperty(null, "currentSection", null).

Essentially, what happens is that the  page is passed an array of 
student objects, and the information obtained from there...
each student object contains an array of course objects, and that's 
where the values are (supposed to be) coming from...
like I said, things work when displaying the form. I'm still a little 
unclear on how the whole "rewind" process works, and I suspect that's where
my problem is coming from...
None of the page properties are (students, course, etc.) are persistent, 
and I'm wondering if that's the problem;
however, i've also tried changing the top level students array, from 
which all of the other objects are obtained, to be persistent, and I 
still wind up with the
same problem.  Any ideas/thoughts/help would be appreciated. Thanks!!

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Form rewinding and updating properties

Posted by Robert Zeigler <rd...@u.arizona.edu>.
Just for the record...

I think I've found the answer to my question...

from the Form component reference comes this tidbit... (regarding the 
"direct" parameter)

"If true (the default), then the direct service is used for the form. 
This decreases the amount of work required to process the form 
submission, and is acceptible for most forms, even those that contain 
Foreaches (but not those that are inside a Foreach). An abbreviated form 
of the rewind cycle takes place, that only references the form and the 
components it wraps."

My forms /are/ being created /inside/  foreaches, and so can't be dealt 
with via the directlink mechanism. Setting "direct" to "false'" solved 
the  particular problem... of course, now I'm getting a class cast 
exception... and the line that is being pointed to as the culprit is the 
page specification line, where I defined my class... (which /does/ 
subclass BasePage...) Anyway, it's progress. Thanks for the ideas 
regarding persistence.

Robert

Petter Måhlén wrote:

>The exception is because the 'course' property is null. If you need the page
>to maintain the same value for 'course' when the form is rendered (shown
>during the GET) and rewound (during the following POST), it needs to be
>persistent. Otherwise, the value will be lost in between the two HTTP
>requests. Most likely, setting it to persistent will solve your problem, but
>it's a bit hard to be sure without more information.
>
>/ Petter
>
>  
>
>>-----Original Message-----
>>From: Robert Zeigler [mailto:rdzeigle@u.arizona.edu] 
>>Sent: den 23 mars 2004 21:56
>>To: Tapestry users
>>Subject: Form rewinding and updating properties
>>
>>
>>Hi,
>>
>>I'm pretty new to tapestry and still trying to get the hang of the 
>>"tapestry way" of doing things.
>>I've got a page that lists out student information (student's 
>>name, etc. 
>>as well as updatable information about the courses a student 
>>is enrolled in,
>>section, status, etc.). I've got the page so that it loads correctly, 
>>finally, but if I try updating the information, I get an ognl 
>>exception:
>>
>>Unable to update expression 'course.currentSection' for 
>>org.eledge.sms.pages.ViewStudent$Enhance_307@169c9a2[ViewStude
>>nt] to null.
>>binding: 	ExpressionBinding[ViewStudent course.currentSection]
>>location: 	context:/WEB-INF/ViewStudent.page, line 56, column 67
>> 
>>
>>
>>ognl.OgnlException
>>target is null for setProperty(null, "currentSection", null).
>>
>>Essentially, what happens is that the  page is passed an array of 
>>student objects, and the information obtained from there...
>>each student object contains an array of course objects, and that's 
>>where the values are (supposed to be) coming from...
>>like I said, things work when displaying the form. I'm still a little 
>>unclear on how the whole "rewind" process works, and I 
>>suspect that's where
>>my problem is coming from...
>>None of the page properties are (students, course, etc.) are 
>>persistent, 
>>and I'm wondering if that's the problem;
>>however, i've also tried changing the top level students array, from 
>>which all of the other objects are obtained, to be persistent, and I 
>>still wind up with the
>>same problem.  Any ideas/thoughts/help would be appreciated. Thanks!!
>>
>>Robert
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Form rewinding and updating properties

Posted by Robert Zeigler <rd...@u.arizona.edu>.
Petter Måhlén wrote:

>The exception is because the 'course' property is null. If you need the page
>to maintain the same value for 'course' when the form is rendered (shown
>during the GET) and rewound (during the following POST), it needs to be
>persistent. Otherwise, the value will be lost in between the two HTTP
>requests. Most likely, setting it to persistent will solve your problem, but
>it's a bit hard to be sure without more information.
>
>/ Petter
>
>  
>

I think I'm probably just going to need to dig into the code on this one 
and have a good long look at rewinding and how that operates.
I tried changing te properties to be persistent, but it didn't solve the 
problem; in fact, it created a new one (now setting the student[] array 
in the page before calling the page,
and then trying to run through the foreach loops is causing grief).
What other information would be useful?

Robert

>>-----Original Message-----
>>From: Robert Zeigler [mailto:rdzeigle@u.arizona.edu] 
>>Sent: den 23 mars 2004 21:56
>>To: Tapestry users
>>Subject: Form rewinding and updating properties
>>
>>
>>Hi,
>>
>>I'm pretty new to tapestry and still trying to get the hang of the 
>>"tapestry way" of doing things.
>>I've got a page that lists out student information (student's 
>>name, etc. 
>>as well as updatable information about the courses a student 
>>is enrolled in,
>>section, status, etc.). I've got the page so that it loads correctly, 
>>finally, but if I try updating the information, I get an ognl 
>>exception:
>>
>>Unable to update expression 'course.currentSection' for 
>>org.eledge.sms.pages.ViewStudent$Enhance_307@169c9a2[ViewStude
>>nt] to null.
>>binding: 	ExpressionBinding[ViewStudent course.currentSection]
>>location: 	context:/WEB-INF/ViewStudent.page, line 56, column 67
>> 
>>
>>
>>ognl.OgnlException
>>target is null for setProperty(null, "currentSection", null).
>>
>>Essentially, what happens is that the  page is passed an array of 
>>student objects, and the information obtained from there...
>>each student object contains an array of course objects, and that's 
>>where the values are (supposed to be) coming from...
>>like I said, things work when displaying the form. I'm still a little 
>>unclear on how the whole "rewind" process works, and I 
>>suspect that's where
>>my problem is coming from...
>>None of the page properties are (students, course, etc.) are 
>>persistent, 
>>and I'm wondering if that's the problem;
>>however, i've also tried changing the top level students array, from 
>>which all of the other objects are obtained, to be persistent, and I 
>>still wind up with the
>>same problem.  Any ideas/thoughts/help would be appreciated. Thanks!!
>>
>>Robert
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Form rewinding and updating properties

Posted by Petter Måhlén <pe...@elevance.se>.
The exception is because the 'course' property is null. If you need the page
to maintain the same value for 'course' when the form is rendered (shown
during the GET) and rewound (during the following POST), it needs to be
persistent. Otherwise, the value will be lost in between the two HTTP
requests. Most likely, setting it to persistent will solve your problem, but
it's a bit hard to be sure without more information.

/ Petter

> -----Original Message-----
> From: Robert Zeigler [mailto:rdzeigle@u.arizona.edu] 
> Sent: den 23 mars 2004 21:56
> To: Tapestry users
> Subject: Form rewinding and updating properties
> 
> 
> Hi,
> 
> I'm pretty new to tapestry and still trying to get the hang of the 
> "tapestry way" of doing things.
> I've got a page that lists out student information (student's 
> name, etc. 
> as well as updatable information about the courses a student 
> is enrolled in,
> section, status, etc.). I've got the page so that it loads correctly, 
> finally, but if I try updating the information, I get an ognl 
> exception:
> 
> Unable to update expression 'course.currentSection' for 
> org.eledge.sms.pages.ViewStudent$Enhance_307@169c9a2[ViewStude
> nt] to null.
> binding: 	ExpressionBinding[ViewStudent course.currentSection]
> location: 	context:/WEB-INF/ViewStudent.page, line 56, column 67
>  
> 
> 
> ognl.OgnlException
> target is null for setProperty(null, "currentSection", null).
> 
> Essentially, what happens is that the  page is passed an array of 
> student objects, and the information obtained from there...
> each student object contains an array of course objects, and that's 
> where the values are (supposed to be) coming from...
> like I said, things work when displaying the form. I'm still a little 
> unclear on how the whole "rewind" process works, and I 
> suspect that's where
> my problem is coming from...
> None of the page properties are (students, course, etc.) are 
> persistent, 
> and I'm wondering if that's the problem;
> however, i've also tried changing the top level students array, from 
> which all of the other objects are obtained, to be persistent, and I 
> still wind up with the
> same problem.  Any ideas/thoughts/help would be appreciated. Thanks!!
> 
> Robert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org