Hi Catalin,
hm..ok it seems to be an issue with the component.
I had a quick look at the irian sandbox examples page; If i choose
another label from the pop-up than the first one, it gets set back to
this first choice after re-rendering.
Means that there is a problem with the id posted back which can not be
mapped to the converter. I will have a look on this on the weekend,
should not be the biggest issue.
cheers,
Gerald
On 1/26/07, Catalin Kormos <[EMAIL PROTECTED]> wrote:
Hi guys,
I have a similar problem with the component which i though it's better to
mention here. As soon as i'm using the "itemLabelMethod" attribute to
specify a label for the objects in the list, there is no submitted value for
the selection. In my case the converter gets invoked but there is no value,
always. Looking at the parameters map that gets back after a submit, there
is no value submitted either, for the right parameter name at least. A value
gets submitted though, under a name like clientId + "_valueFake"...any
ideeas?
Thanks,
Catalin
On 1/26/07, Gerald Müllan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> are you sure that the converter`s getAsObject() is not invoked? Step
> in with a debugger and see what happens.
>
> Also try to give the suggestPerson a default person object. I can not
> see any problems why the converter should not be invoked after the
> post-back.
>
> cheers,
>
> Gerald
>
> On 1/25/07, Thomas Kurzman <[EMAIL PROTECTED]> wrote:
> > Ok i think i was wrong. Not the value String is empty but the
getAsObject()-method is NEVER be invoked!
> >
> > When dropping down the list by clicking on the down-arrow-button the
following data will be transmitted (I found this out with an
http-debugger;):
> >
> > [["Albert Einstein","1"],["Steven Hawking","2"],]
> >
> > So, this should be ok...
> >
> > ...but then i found out tha this converter-method will never be invoked:
> >
> > public Object getAsObject(FacesContext context, UIComponent component,
String value) throws ConverterException {
> > context.getExternalContext().log("In getAsObject!");
> > ....
> >
> > I found NO "In getAsObject!" in the log files (But logging works
perfect)!
> >
> > Any ideas?
> >
> > Also have a look at the requests and response:
> >
> >
> > First the request when clicking on the down-arrow-button to retrieve the
suggest list:
> > -------------------------------------------
> > POST
/InputSuggestAjax/faces/inputsuggesajax.jsp?affectedAjaxComponent=form1:personInput&charset=utf-8&form1:personInput=
HTTP/1.1
> > Accept: */*
> > Accept-Language: de-at
> > Referer: http://localhost:8084/InputSuggestAjax/
> > Content-Type: application/x-www-form-urlencoded
> > Accept-Encoding: gzip, deflate
> > User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322)
> > Host: localhost:8084
> > Content-Length: 126
> > Proxy-Connection: Keep-Alive
> > Pragma: no-cache
> > Cookie: JSESSIONID=F5AEB6F0457BB99B2E1242C6D650B090
> >
> >
javax.faces.ViewState=rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAIxM3B0ABQvaW5wdXRzdWdnZXNhamF4LmpzcA%3D%3D
> > -------------------------------------------
> >
> >
> > This ends up in the following response:
> > -------------------------------------------
> > HTTP/1.1 200 OK
> > Server: Apache-Coyote/1.1
> > Content-Type: text/html;charset=utf-8
> > Content-Language: de
> > Content-Length: 49
> > Date: Thu, 25 Jan 2007 00:49:34 GMT
> >
> > [["Albert Einstein","1"],["Steven Hawking","2"],]
> > -------------------------------------------
> >
> >
> > After this, when I submit the form following request will be send:
> > -------------------------------------------
> > POST /InputSuggestAjax/faces/inputsuggesajax.jsp
HTTP/1.1
> > Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, application/x-icq, */*
> > Referer: http://localhost:8084/InputSuggestAjax/
> > Accept-Language: de-at
> > Content-Type: application/x-www-form-urlencoded
> > Accept-Encoding: gzip, deflate
> > User-Agent: Mozilla/4.0 (compatible; MSIE 6.0 ; Windows NT 5.1; SV1;
.NET CLR 1.1.4322)
> > Host: localhost:8084
> > Content-Length: 301
> > Proxy-Connection: Keep-Alive
> > Pragma: no-cache
> > Cookie: JSESSIONID=F5AEB6F0457BB99B2E1242C6D650B090
> >
> >
undefined=Steven+Hawking&undefined_selected=2&form1%3ApersonInput_valueFake=Steven+Hawking&form1%3A_idJsp0=Anfrage+senden&form1_SUBMIT=1&form1%3A_link_hidden_=&form1%3A_idcl=&javax.faces.ViewState=rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAIxM3B0ABQvaW5wdXRzdWdnZXNhamF4LmpzcA%3D%3D
> > -------------------------------------------
> >
> >
> > This produces the following response:
> > -------------------------------------------
> > HTTP/1.1 200 OK
> > Server: Apache-Coyote/1.1
> > Content-Type: text/html;charset=UTF-8
> > Content-Language: de
> > Content-Length: 2945
> > Date: Thu, 25 Jan 2007 00:49:53 GMT
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> > "http://www.w3.org/TR/html4/loose.dtd">
> >
> >
> > <html>
> > <head>
> > <script type="text/javascript"><!--
> > /*djconfig init*/
> > //--></script>
> > <script type="text/javascript"><!--
> > var djConfig = {
> >
> > };
> >
> > //--></script>
> > <script type="text/javascript"
src="/InputSuggestAjax/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11696853/dojo.DojoResourceLoader/dojo.js"><!--
> >
> > //--></script>
> > <script type="text/javascript"><!--
> > dojo.setModulePrefix('extensions',
'../dojoextensions.ResourceLoader');
> > //--></script>
> > <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
> > <title>inputsuggestajax-test</title>
> > </head>
> > <body cellpadding="0" cellspacing="0">
> > <form id="form1" name="form1" method="post"
action="/InputSuggestAjax/faces/inputsuggesajax.jsp"
enctype="application/x-www-form-urlencoded">
> >
> >
> > <script type="text/javascript"><!--
> > dojo.require('extensions.FacesIO');
> > //--></script><script type="text/javascript"><!--
> > dojo.require('dojo.widget.ComboBox');
> > //--></script><script type="text/javascript"><!--
> > dojo.require('dojo.event.*');
> > //--></script><div id="form1:personInput"></div><script
type="text/javascript"><!--
> > var form1_personInput_dojoControl =
dojo.widget.createWidget("ComboBox",{mode:'remote',autoComplete:true,dataUrl:'/InputSuggestAjax/faces/inputsuggesajax.jsp?affectedAjaxComponent=form1:personInput&charset=utf-8&form1:personInput=%{searchString}'},
dojo.byId('form1:personInput'));
> > //--></script><script type="text/javascript"><!--
> > dojo.addOnLoad(function() {
> >
form1_personInput_dojoControl.textInputNode.name="form1:personInput_valueFake";
> > form1_personInput_dojoControl.textInputNode.value =
"foo";
> > form1_personInput_dojoControl.comboBoxValue.value =
"foo";
> > form1_personInput_dojoControl.onResize();
> > });
> >
> > //--></script>
> > <input id="form1:_idJsp0" name="form1:_idJsp0"
type="submit" onclick="if(typeof
window.clearFormHiddenParams_form1!='undefined'
){clearFormHiddenParams_form1('form1');}" />
> > <input type="hidden" name="form1_SUBMIT" value="1" /><input
type="hidden" name="form1:_link_hidden_" /><input type="hidden"
name="form1:_idcl" /><script type="text/javascript"><!--
> >
> > function clear_form1()
> > {
> > clearFormHiddenParams_form1('form1');
> > }
> >
> > function
clearFormHiddenParams_form1(currFormName)
> > {
> > var f = document.forms['form1'];
> >
f.elements['form1:_link_hidden_'].value='';
> > f.elements['form1:_idcl'].value='';
> > f.target='';
> > }
> >
> > clearFormHiddenParams_form1();
> > //--></script><input type="hidden" name="javax.faces.ViewState" id="
javax.faces.ViewState"
value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAIxNXB0ABQvaW5wdXRzdWdnZXNhamF4LmpzcA=="
/></form>
> > <!-- MYFACES JAVASCRIPT -->
> >
> > </body>
> > </html>
> > -------------------------------------------
> >
> >
> > And finally, this is my inputsuggesajax.jsp
> > -------------------------------------------
> > <[EMAIL PROTECTED] contentType="text/html"%>
> > <[EMAIL PROTECTED] pageEncoding="UTF-8"%>
> >
> > <%@ taglib uri="http://java.sun.com/jsf/core " prefix="f"%>
> > <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> > <%@ taglib uri=" http://myfaces.apache.org/tomahawk"
prefix="t"%>
> > <%@ taglib uri="http://myfaces.apache.org/sandbox"
prefix="s"%>
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> > "http://www.w3.org/TR/html4/loose.dtd">
> >
> > <f:view>
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
> > <title>inputsuggestajax-test</title>
> > </head>
> > <body cellpadding="0" cellspacing="0">
> > <h:form id="form1">
> > <s:inputSuggestAjax id="personInput"
suggestedItemsMethod="#{
personInputSuggestAjaxBean.getPersons}"
itemLabelMethod="#{personInputSuggestAjaxBean.getPersonsLabel}"
> >
style="width:100px;"
value="#{personInputSuggestAjaxBean.suggestPerson }"
charset="utf-8">
> > <f:converter
converterId="PersonInputSuggestAjaxConverter" />
> > </s:inputSuggestAjax>
> > <h:commandButton />
> > </h:form>
> > </body>
> > </html>
> > </f:view>
> > -------------------------------------------
> >
> > Do you thing are there any problems with this jsp???
> >
> > I'm working with the following libs:
> >
> > commons-beanutils-1.7.0.jar
> > commons-codec-1.3.jar
> > commons-collections-3.1.jar
> > commons-digester-1.6.jar
> > commons-el-1.0.jar
> > commons-fileupload-1.1.1.jar
> > commons-lang-2.1.jar
> > commons-logging-1.0.4.jar
> > jstl-1.1.0.jar
> > myfaces-api-1.1.5-SNAPSHOT.jar
> > myfaces-impl-1.1.5-SNAPSHOT.jar
> > tomahawk-1.1.5-SNAPSHOT.jar
> > tomahawk-sandbox-1.1.5-SNAPSHOT.jar
> >
> > I have downloaded the *-SNAPSHOT.jar's yesterday.
> >
> > And I'm using Tomcat 5.5.17.
> >
> >
> > -------- Original-Nachricht --------
> > Datum: Thu, 25 Jan 2007 00:31:16 +0100
> > Von: "Gerald M�llan" <[EMAIL PROTECTED]>
> > An: "MyFaces Discussion" < [email protected]>
> > Betreff: Re: [Sandbox] InputSuggestAjax problem - getAsObject doesn\'t
retrieve the suggested value
> >
> > > Hi,
> > >
> > > the question is, why is the value empty? If you do correct work inside
> > > the getAsString(..) method of the converter, there must be a
> > > corresponding value mapped to each label on client side.
> > >
> > > You can easily confirm this by using a http-debugger, the JSON format
> > > must consist of something like
> > >
[["yourFistLabel","yourFirstValue"],["yourSecondLabel","yourSecondValue"]..].
> > >
> > > When choosing a value out of the popUp list, the value is written into
> > > a hidden field and posted back to server, which in turn should *not*
> > > be empty.
> > >
> > > Any new cognitions?
> > >
> > > cheers,
> > >
> > > Gerald
> > >
> > > On 1/24/07, Thomas Kurzman <[EMAIL PROTECTED]> wrote:
> > > > Hi experts!
> > > >
> > > > Like in
http://wiki.apache.org/myfaces/InputSuggestAjax i worked
out an
> > > example-app for advanced key/value usage.
> > > > Everything works fine. The only problem is when i choose an value
and
> > > submit the form the value string of the getAsObject-method is empty
(not null
> > > but empty -> "").
> > > > When i was looking for a solution i found this:
> > > >
http://www.mail-archive.com/[email protected]/msg31764.html
> > > > In addition to this post i could say (because i have logged all the
> > > stuff what's going on) that the setter of the choosenValue will be
called (when
> > > the form is submitted i.e. BEFORE page refresh) and also the
> > > getAsObject-method, as i mentioned before, will be called (AFTER page
refresh) but with
> > > an empty String as value.
> > > > So, as a logic konsequence, i never get a correct chooseValue when
the
> > > page is refreshed after the form-submit.
> > > >
> > > > So does anybody know how to fix this or has an solution for this?
> > > >
> > > > best,
> > > > tom
> > > > --
> > > > "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
> > > > Jetzt GMX ProMail testen:
http://www.gmx.net/de/go/promail
> > > >
> > >
> > >
> > > --
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> >
> > --
> > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> > Ideal f�r Modem und ISDN:
http://www.gmx.net/de/go/smartsurfer
> >
>
>
> --
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces