Dan you have mis understood me entirely
Forget the table example . As I said I put in a simple example to try out
the JSF dynamic aspect
1 label 1 text field 1 radio button
radio button set to onclick, call javascript.
document look up on the text field and label . All ok
refresh executed, the backing bean gets invoked ( meaning that everything is
set up ok ).
The get method , to update the label on the screen definitely gets invoked,
but when JSF tries to
return the value, thats when the exception occurs. Not within my get method,
but within the JSF renderer
( as listed in previous threads ).
I take on board all your points but I knew about them already, and had
ensured that none of these were causing me a problem . So the table is a red
herring in this case.
How about just getting a better exception message in place to see the actual
class that is being sent to the renderer. By saying that UIComponent is
expected tells us nothing other than a class incompatability with a
parameter being passed.
Dan Labrecque wrote:
>
> It is very difficult to debug over e-mail, but there may be a couple
> simple tests you can run. For example, add your hidden fields directly
> in the "<webuijsf:form" body -- this takes the subview and table out of
> the equation. If your code still does not function, then there may be a
> problem with JSF and Facelets.
>
> If JSF is saying there is no UIComponent, there are only a couple cases
> I can think of where this might happen.
>
> 1. You have not provided the correct component ids to the refresh
> function. I'm suspicious because the tableRowGroup should output an id
> like so:
>
> "form1:table1:rowGroup1:2:col1:j_id_id27"
>
> You're calling:
>
> columnDomNode.refresh("toplevelform:j_id26:var3");
>
> Note that there is no row index here, so it doesn't seem as if you're
> working with a table. Perhaps this thread has the wrong subject???
>
> 2. You have not provided an id to all tags. If the page changes at all
> (e.g., a component is hidden/added/removed), JSF will generate different
> ids. This would result in JSF not being able to locate your subview.
>
> Using "toplevelform:j_id26:var3" as an example, I can see that you have
> not provided an id for the subview. I suspect this may be your problem
> -- these ids are not maintained and generated dynamically during each
> request.
>
> 3. The component does not exist in the JSF component tree. This could
> happen if you create components dynamically (e.g., via Java) and have
> not assigned a parent or added the component as a child.
>
> 4. The component tree may not have been reconstituted. This could be an
> issue with Facelets and JSF. It may also a problem with the web
> container you're using. What are you using as a web container?
>
> 5. The table cannot find the component associated with the id given to
> the refresh function. This could be due to #4 or #3, but moving the
> hidden fields outside the table (in the test above) will prove that.
>
> Sorry I cannot be more helpful,
> Dan
>
> stuartr wrote:
>> yes they belong to the parent . They are defined within my xhtml file(s)
>>
>> The hierachy is something like
>>
>> myform:mysubview:componentX
>>
>>
>> The items belong to a <f:subview id="mysubview"
>>
>> which belongs to the top level view .
>>
>>
>> Any way of tracing at the server side ( log4j logger ??? debug levels ???
>> )
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Dan Labrecque wrote:
>>
>>> That would explain why the component isn't updated client-side. I don't
>>> know what JSON properties you previously saw in Firebug, but it seems
>>> the response may not be generated correctly. In order to update
>>> client-side, the response must have JSON properties containing an id,
>>> value, etc.
>>>
>>> Are you're hidden fields part of the JSF component tree (i.e., did you
>>> set a parent, add the component as a child, etc.)? All JSF based
>>> components must have an id and parent in order to be placed in the JSF
>>> component tree. When an Ajax request is generated, Dynamic Faces will
>>> attempt to locate the given ids (execute params) in the JSF component
>>> tree in order to decode/validate/update and ultimately render.
>>>
>>> Dan
>>>
>>> stuartr wrote:
>>>
>>>> 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#a14022079
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.