users@woodstock.java.net

Re: Table + AJAX

From: stuartr <stuart.russell_at_sun.com>
Date: Wed, 28 Nov 2007 07:04:59 -0800 (PST)

getting an error from Httprequest on ajax.
basically, when I look at firebug I get


<pre>java.lang.IllegalStateException: Class returned from
AsyncResponse.getPartialTraversalViewRoot

 must be a UIComponent


com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle

.java:132)

        javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)

</pre></p><p>note <u>The full stack trace of the root cause is available in
the Apache Tomcat


I will forward on details on error in tomcat however, the request actually
does get sent to the server, its the response that is in error.

Any ideas. ????
( really need this working, deadline approxing )




Dan Labrecque wrote:
>
>
> stuartr wrote:
>> Dont understand you dan ?
>>
>
> If the backing bean is request scoped, subsequent refresh calls will not
> retain local values as you might expect. Local variables will be set for
> the current request, but unless the bean is session scoped, any values
> you previously set will be lost. Therefore, I have to ask again; is your
> backing bean session scoped?
>
>> The backing bean is being invoked based on the refresh, I can see the
>> getMethods getting invoked , however, nothing is updated at the client
>> side.
>> I have debug at the backing end to show me what is being returned to the
>> client.
>> I see the actual value being returned
>> such as
>>
>> public String getVar1Value() {
>>
>> if ( cachedRowSetListener == null ) {
>> rtn="initialvalue";
>> } else {
>>
>> .....do some work ....
>> rtn = blablbal
>> }
>>
>>
>> logger.debug("The value being returned to client is "+rtn);
>>
>>
>>
>> return rtn;
>>
>> }
>>
>>
>> I just sent the example to simplify what I was doing.
>>
>> Within the logger line I see the value changes. I also see the JSON
>> response
>> to the client within firebug, but nothing happens on screen. And when I
>> do
>> any alerts in my code in the client to check the values of the local dom
>> object ( ie the hidden fields/text fields whatever ) they still have
>> their
>> old value.
>>
>
> Looking at the "logger" output may not be enough. The table iterates
> over many rows, so I cannot be certain which component you're actually
> dealing with. Looking at the response in Firebug may be your best bet.
> If you can see the desired value being returned, via JSON properties,
> then we can go from there. What does the response look like?
>
> Dan
>
>>
>>
>> Dan Labrecque wrote:
>>
>>> Considering your code is based on a local "firstTime" variable, is your
>>> bean session scoped? If the bean is request scoped, "firstTime" will be
>>> initialized similarly during each request.
>>>
>>> FYI, instead of refreshing each hidden field separately, you could use
>>> the following code, instead. Note that when the component id is not
>>> provided, the refresh function acts as a reset. That is, the component
>>> will be redrawn only using values set server-side.
>>>
>>> newurlNode.refresh("toplevelform:j_id26:var1,
>>> toplevelform:j_id26:var2,
>>> toplevelform:j_id26:var3");
>>>
>>> Dan
>>>
>>> stuartr wrote:
>>>
>>>> Sure
>>>>
>>>> What happens is that I generate a table using a binding and within the
>>>> table
>>>> there is a column
>>>> which is a hyper link.
>>>> I have defined an onclick to invoke a javascript function.
>>>>
>>>> I also have 3 hidden variables as
>>>> <webuijsf:hidden id="var1" value="#{backingBean.var1Value}" />
>>>> <webuijsf:hidden id="var2" value="#{backingBean.var2Value}" />
>>>> <webuijsf:hidden id="var3" value="#{backingBean.var3Value}" />
>>>>
>>>> function linkClicked(row,data) {
>>>>
>>>> alert("User has pressed something on row "+row+" Data item
>>>> "+data);
>>>>
>>>> newurlNode=document.getElementById("toplevelform:j_id26:var3");
>>>> alert("Present value is "+newurlNode.text);
>>>>
>>>> // okay we have a drilldown on data within a panel of reports.
>>>> rowDomNode=document.getElementById("toplevelform:j_id26:va1");
>>>> rowDomNode.value=row;
>>>>
>>>> columnDomNode=document.getElementById("toplevelform:j_id26:var2");
>>>> columnDomNode.value=data;
>>>>
>>>>
>>>> rowDomNode.refresh("toplevelform:j_id26:var1,toplevelform:j_id26:var2");
>>>>
>>>> // now refresh the actual new urlnode to having a new value.
>>>>
>>>> columnDomNode.refresh("toplevelform:j_id26:var3");
>>>>
>>>> newurlNode=document.getElementById("toplevelform:j_id26:var3");
>>>>
>>>> newurlNode.refresh(); // get the value from the back end.
>>>>
>>>>
>>>> alert("THe value should have changed by now
>>>> "+newurlNode.value);
>>>>
>>>> popupWin = window.open(newurlNode.value,'View File
>>>> Link','scrollbars,resizable,width=700,height=900,top='+((screen.height
>>>> -
>>>> (screen.height/1.618)) - (500/2))+',left='+((screen.width-650)/2) );
>>>>
>>>> }
>>>>
>>>>
>>>> Now I now that the backing bean is being called as by log4j output
>>>> shows
>>>> that the setter method is being invoked
>>>>
>>>> public String getVar3Value() {
>>>> String rtn="INITIALVALUE";
>>>>
>>>> if ( !firstTime ) {
>>>> .....do some work...
>>>> rtn="value from doing work";
>>>> }
>>>>
>>>> return rtn;
>>>> }
>>>>
>>>> Everything works all the way to the return statement. However the new
>>>> value
>>>> never gets reflected in the client.
>>>> The client just stays at the initial value which was set within
>>>> getVar3Value
>>>> the first time the code was called.
>>>> I have debug within the if block so I can see exactly what is getting
>>>> called, the client just never updates the value .
>>>>
>>>> Also, I tried a hyperlink on the screen as per the examples within
>>>> woodstock
>>>> and I expected to see the hyperlink change however, nothing happens.
>>>>
>>>>
>>>> Anyhelp appreciated.
>>>>
>>>> Thanks
>>>>
>>>> ( Ps Im using nearly all of the woodstock components within this
>>>> application
>>>> so im quite used to the syntax and model )
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Venkatesh Babu-5 wrote:
>>>>
>>>>
>>>>> Could you show the code snippet for the ajax refresh you are doing.
>>>>> How are you updating the server side data and doing the label refresh.
>>>>>
>>>>> -Venky
>>>>>
>>>>> stuartr wrote:
>>>>>
>>>>>
>>>>>> Guys
>>>>>> Im having a problem with any of the textfield, hidden , hyperlink etc
>>>>>> to
>>>>>> allow for ajax refresh.
>>>>>> My code has an onclick which updates the server side, and then
>>>>>> invokes
>>>>>> a
>>>>>> refresh on a label
>>>>>> I have on the screen. Basically, the code at the back end bean gets
>>>>>> invoked
>>>>>> to get the new value
>>>>>> for the label, and using firebug I can see the request.
>>>>>> However, nothing happens at the client side. the label just never
>>>>>> changes
>>>>>> its value.
>>>>>>
>>>>>> Im using facelets along with my woodstock components.
>>>>>>
>>>>>>
>>>>>> Stu
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Dan Labrecque wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> The prototype was available in the Woodstock milestone builds, but
>>>>>>> is
>>>>>>> disabled for the official 4.1 release. It will be enabled again in
>>>>>>> the
>>>>>>> 4.2 milestone builds as we complete the widget.
>>>>>>>
>>>>>>> Dan
>>>>>>>
>>>>>>> Lking wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Thanks Dan.
>>>>>>>>
>>>>>>>> Is this "table2" available for trying?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Nov 21, 2007 6:46 PM, Dan Labrecque <Dan.Labrecque_at_sun.com
>>>>>>>> <mailto:Dan.Labrecque_at_sun.com>> wrote:
>>>>>>>>
>>>>>>>> Not all components support this API -- please see the TLD for
>>>>>>>> supported
>>>>>>>> JavaScript features. There is a table2 component in the works
>>>>>>>> which is
>>>>>>>> fully Ajax enabled and supports the refresh feature.
>>>>>>>>
>>>>>>>> Dan
>>>>>>>>
>>>>>>>> Lking wrote:
>>>>>>>> > How can I get a client-side update with the Table component?
>>>>>>>> > I was trying something like...
>>>>>>>> >
>>>>>>>> >
>>>>>>>>
>>>>>>>> onChange="document.getElementById('form1:table1').refresh('form1:textfield1');"
>>>>>>>> >
>>>>>>>> > but it doesn't work.
>>>>>>>> >
>>>>>>>> > thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail:
>>>>>>>> users-unsubscribe_at_woodstock.dev.java.net
>>>>>>>> <mailto:users-unsubscribe_at_woodstock.dev.java.net>
>>>>>>>> For additional commands, e-mail:
>>>>>>>> users-help_at_woodstock.dev.java.net
>>>>>>>> <mailto:users-help_at_woodstock.dev.java.net>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
>>>>>>> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

-- 
View this message in context: http://www.nabble.com/Table-%2B-AJAX-tf4852715.html#a13994049
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.