AnsweredAssumed Answered

Create new page :the same  add-content-dialog.jsp?

Question asked by linhnh on Mar 5, 2008
hi all. I want to create new page that is the same add-content-dialog.jsp
but in List objectTypes have some specific content model.
then I custom basecontentwizad bean
I add some code that is
public List<SelectItem> getDetaiObjects()
   {
      if (this.detaiObjects == null)
      {
         FacesContext context = FacesContext.getCurrentInstance();
        
         // add the well known object type to start with
         this.detaiObjects = new ArrayList<SelectItem>(5);
       //  this.detaiObjects.add(new SelectItem(ContentModel.TYPE_CONTENT.toString(),
          //     Application.getMessage(context,"Content")));
        
         // add any configured content sub-types to the list
         ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
         Config wizardCfg = svc.getConfig("Content Wizards");
         if (wizardCfg != null)
         {
            ConfigElement typesCfg = wizardCfg.getConfigElement("content-types");
            if (typesCfg != null)
            {              
               for (ConfigElement child : typesCfg.getChildren())
               {
                  QName idQName = Repository.resolveToQName(child.getAttribute("name"));
                  if (idQName != null)
                  {
                     TypeDefinition typeDef = this.dictionaryService.getType(idQName);
                    
                     if (typeDef != null)
                     {
                        if (this.dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT))
                        {
                           // try and get the display label from config
                           String label = Utils.getDisplayLabel(context, child);
        
                           // if there wasn't a client based label try and get it from the dictionary
                         
                           if (label == null)
                           {
                              label = typeDef.getTitle();
                              }
                      
                           // finally, just use the localname
                           if (label == null)
                           {
                              label = idQName.getLocalName();
                           }
                          /////add to list
                          if (label.equalsIgnoreCase("Ket Qua")){
                           this.detaiObjects.add(new SelectItem(idQName.toString(), label));
                           }
                         /////
                        }
                        else
                        {
                           logger.warn("Failed to add '" + child.getAttribute("name") +
                                 "' to the list of content types as the type is not a subtype of cm:content");
                        }
                     }
                     else
                     {
                        logger.warn("Failed to add '" + child.getAttribute("name") +
                              "' to the list of content types as the type is not recognised");
                     }
                  }
               }
              
               // make sure the list is sorted by the label
               QuickSort sorter = new QuickSort(this.detaiObjects, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
               sorter.sort();
            }
            else
            {
               logger.warn("Could not find 'content-types' configuration element");
            }
         }
         else
         {
            logger.warn("Could not find 'Content Wizards' configuration section");
         }
        
      }
     
      return this.detaiObjects;
   } 
then in new jsp page I use
<td>
<h:selectOneMenu id="object-type" value="#{AddContentDialog.detaiObjects}">
<f:selectItems value="#{AddContentDialog.detaiObjects}" />
</h:selectOneMenu>
</td>
and I have some error
javax.faces.FacesException: Value is no String and component add-content-upload-end:object-type does not have a Converter
caused by:
org.apache.jasper.JasperException: Value is no String and component add-content-upload-end:object-type does not have a Converter
caused by:
java.lang.IllegalArgumentException: Value is no String and component add-content-upload-end:object-type does not have a Converter

hik hik. where is wrong?
thanks.

Outcomes