Yeah, I didn't think that would do anything, but I figured it was worth a shot.
Like I said, it seems like nothing is coming back on the request.
Start debugging through the renderer's decode method.
On Fri, 18 Mar 2005 18:24:28 +0000, Kostas Karadamoglou
<[EMAIL PROTECTED]> wrote:
> No! the same problem, nothing changed.
> I am so desperate :(
>
> Heath Borders wrote:
>
> >Do this:
> >
> >private Converter myConverter = new MyConverter();
> >
> >public Converter getMyConverter()
> >{
> >return myConverter;
> >}
> >
> >then, converter="#{myBean.myConverter}" in your jsp.
> >
> >
> >On Fri, 18 Mar 2005 18:13:51 +0000, Kostas Karadamoglou
> ><[EMAIL PROTECTED]> wrote:
> >
> >
> >>How? I didn't understand it. Can you please give me an example?
> >>Heath Borders wrote:
> >>
> >>
> >>
> >>>Here's another option. Rather than making the converter a faces
> >>>managed bean, you can make it an instance variable of yoru event
> >>>handler. Try that and see if it works better.
> >>>
> >>>
> >>>On Fri, 18 Mar 2005 17:30:41 +0000, Kostas Karadamoglou
> >>><[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Couldn't it be consindered as a bug?
> >>>>Does anyone eles have the same problem?
> >>>>
> >>>>Heath Borders wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>oh. Sorry I misunderstood your first email.
> >>>>>
> >>>>>That means that there's something wrong with the selectOneMenu or
> >>>>>something.
> >>>>>
> >>>>>
> >>>>>On Fri, 18 Mar 2005 16:22:42 +0000, Kostas Karadamoglou
> >>>>><[EMAIL PROTECTED]> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Yes but how can JSF call the getAsObject method of the converter with
> >>>>>>the str parameter equals to null !!!
> >>>>>>
> >>>>>>I checked the generated code and the all the option tags in the drop
> >>>>>>down menu have a value ("1","2","3","4","5" and so on)
> >>>>>>So how jsf returns a null string? thats the problem. :(
> >>>>>>Heath Borders wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>No, you don't want to do that. Otherwise, the category object will
> >>>>>>>not be properly set in his setter. The problem is definitely with
> >>>>>>>your converter. My guess is that its getting re-created between
> >>>>>>>requests, and thus the map is getting cleared. I couldn't tell you
> >>>>>>>why that's happening, though.
> >>>>>>>
> >>>>>>>
> >>>>>>>On Fri, 18 Mar 2005 11:05:23 -0500, Srikanth Madarapu
> >>>>>>><[EMAIL PROTECTED]> wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>Can you try
> >>>>>>>>
> >>>>>>>>this.allCategories.add(new SelectItem(category.getId(),
> >>>>>>>>category.getTitle()));
> >>>>>>>>
> >>>>>>>>The getId() method should return the same value as returned by
> >>>>>>>>getAsString(). I think there is some problem...
> >>>>>>>>
> >>>>>>>>Srikanth
> >>>>>>>>
> >>>>>>>>-----Original Message-----
> >>>>>>>>From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]
> >>>>>>>>Sent: Friday, March 18, 2005 10:56 AM
> >>>>>>>>To: MyFaces Discussion
> >>>>>>>>Subject: Re: Problem with the getAsObject of a Converter
> >>>>>>>>
> >>>>>>>>Hi, I attached the getter of allcategories, as you can see I return a
> >>>>>>>>list of selectItem objects
> >>>>>>>>
> >>>>>>>>public List getAllCategories(){
> >>>>>>>> if(this.allCategories==null){
> >>>>>>>> this.allCategories=new ArrayList();
> >>>>>>>> this.allCategories.add(new SelectItem(new Category(),"Choose
> >>>>>>>>a category..."));
> >>>>>>>> List categories=this.eventRegistry.getCategories();
> >>>>>>>> for(Iterator iter=categories.iterator(); iter.hasNext();){
> >>>>>>>> Category category=(Category)iter.next();
> >>>>>>>> this.allCategories.add(new SelectItem(category,
> >>>>>>>>category.getTitle()));
> >>>>>>>> }
> >>>>>>>> }
> >>>>>>>> return this.allCategories;
> >>>>>>>>}
> >>>>>>>>
> >>>>>>>>Srikanth Madarapu wrote:
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>What is the return type of allCategories ?
> >>>>>>>>>
> >>>>>>>>>The list coming from allCategories should be a list of "SelectItem"
> >>>>>>>>>objects, I think in yours case its just a list of Strings
> >>>>>>>>>
> >>>>>>>>>-Srikanth
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>-----Original Message-----
> >>>>>>>>>From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]
> >>>>>>>>>Sent: Friday, March 18, 2005 9:17 AM
> >>>>>>>>>To: [email protected]
> >>>>>>>>>Subject: Problem with the getAsObject of a Converter
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>Hi again!!!
> >>>>>>>>>
> >>>>>>>>>I have another problem now, Very strange Can you suggest me a
> >>>>>>>>>solution?
> >>>>>>>>>
> >>>>>>>>>I created a converter for objects of type Category in order to
> >>>>>>>>>display
> >>>>>>>>>some Category beans in a selectOneMenu tag.
> >>>>>>>>>
> >>>>>>>>>I have debuged the application and I noticed a strange behaviour of
> >>>>>>>>>JSF
> >>>>>>>>>which I cannot understand.
> >>>>>>>>>Below I have the sequence explanation of the problem and the content
> >>>>>>>>>of
> >>>>>>>>>each method and jsp fragment.
> >>>>>>>>>
> >>>>>>>>>1)The getAsString method works perfectly and returns the following
> >>>>>>>>>strings "0","1","2","3","4","5","6","7"
> >>>>>>>>>
> >>>>>>>>>2)The page is displayed properly, and I choose from the drop down
> >>>>>>>>>menu a
> >>>>>>>>>category.
> >>>>>>>>>
> >>>>>>>>>2)Afterwords JSF invokes getAsObject (I think for the chosen option)
> >>>>>>>>>with the str parameter null !!!!!!!
> >>>>>>>>>In this situation I return a null object (which is wrong).
> >>>>>>>>>
> >>>>>>>>>4)After that when the page is redisplayed the getAsString throw an
> >>>>>>>>>Exception because of the null value
> >>>>>>>>>
> >>>>>>>>>JSP-------------------------------------------------------
> >>>>>>>>><h:selectOneMenu id="selectCategory"
> >>>>>>>>>converter="#{categoryConverter}"
> >>>>>>>>>value="#{eventHandler.selectedCategory}">
> >>>>>>>>> <f:selectItems id="allCategories"
> >>>>>>>>>value="#{eventHandler.allCategories}"/>
> >>>>>>>>></h:selectOneMenu>
> >>>>>>>>>
> >>>>>>>>>getAsString------------------------------------------------
> >>>>>>>>>
> >>>>>>>>>public String getAsString(FacesContext facesContext, UIComponent
> >>>>>>>>>uIComponent, Object obj) throws ConverterException {
> >>>>>>>>> String retValue=null;
> >>>>>>>>> if(obj==null)
> >>>>>>>>> throw new ConverterException("not null object of type
> >>>>>>>>>Category expected");
> >>>>>>>>> else if(obj instanceof Category){
> >>>>>>>>> Category category=(Category)obj;
> >>>>>>>>> map.put(new Integer(category.getId()), category);
> >>>>>>>>> retValue=String.valueOf(category.getId());
> >>>>>>>>> }else{
> >>>>>>>>> throw new ConverterException("object of type Category
> >>>>>>>>>expected received: "+obj.getClass().getName()+"="+obj.toString());
> >>>>>>>>> }
> >>>>>>>>> return retValue;
> >>>>>>>>>}
> >>>>>>>>>
> >>>>>>>>>getAsObject------------------------------------------------
> >>>>>>>>>
> >>>>>>>>> public Object getAsObject(FacesContext facesContext, UIComponent
> >>>>>>>>>uIComponent, String str) throws ConverterException {
> >>>>>>>>> Category retValue=null;
> >>>>>>>>> if(str!=null){
> >>>>>>>>> try{
> >>>>>>>>> System.out.println(str);
> >>>>>>>>> Integer id=Integer.valueOf(str);
> >>>>>>>>> retValue=(Category)map.get(id);
> >>>>>>>>> }catch(Exception ex){
> >>>>>>>>> throw new ConverterException("a number formatted string
> >>>>>>>>>expected");
> >>>>>>>>> }
> >>>>>>>>>
> >>>>>>>>> }else{
> >>>>>>>>> //throw new ConverterException("a not null string expected");
> >>>>>>>>> return null;
> >>>>>>>>> }
> >>>>>>>>> return retValue;
> >>>>>>>>>}
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
>
>
--
-Heath Borders-Wing
[EMAIL PROTECTED]