cancel
Showing results for 
Search instead for 
Did you mean: 

JSP page modifications

soeursourire
Champ in-the-making
Champ in-the-making
Hi!

I got into troubles while adding a field "pays" and /or a listbox "userNames" in person-properties.jsp. Here is what I am doing and the error I have while opening this page. Please tell me what I am doing wrong or what I am missing?

- I create a sub-class MyNewUserWizard
- Inside I added two attributes :
-            protected String pays = null;
-            protected static List<SelectItem> userNames = null;
- I initialize this list as follow:
-             this.userNames= new ArrayList<SelectItem>(8);
-             userNames.add(new SelectItem("soso", "Sophie"));
-             userNames.add(new SelectItem("charlot","Charlot"));
- I added this listbox in my jsp page as follow:
- <tr>
        <td>
        <div style="padding:4px">
        <h:selectOneListbox id="userNames" style="width:250px" size="5">
        <f:selectItems value="#{MyNewUserWizard.userNames}" />
        </h:selectOneListbox>
        </div>
        </td>
   </tr>
- And I would like to use MyNewUserWizard instead of NewUserWizard
- But how can I do to modify <h:input value = #(NewUserWizard.email) How can I use MyNewUserWizard.setEmail() here?
- I added "pays" in ContentModel.xml and I added a manage-bean MyNewUserWizard in faces-config.xml
- But I still have the following error while opening the page:
-       javax.portlet.PortletException: org.apache.jasper.JasperException: Bean: org.alfresco.web.bean.wizard.MyNewUserWizard, propertySmiley Tongueays

Please tell me what is wrong here?
Thanks in advance
14 REPLIES 14

soeursourire
Champ in-the-making
Champ in-the-making
I forgot but I also tried like this:
- I created a MyCustomModel.xml where I added this aspect:
<aspects>
      <aspect name="customSmiley Tongueays">
         <title>Department</title>
         <properties>
            <property name="customSmiley Tongueays">
               <type>d:int</type>
            </property>
         </properties>
      </aspect>
   </aspects>

- And I added it in extension-context.xml…

gavinc
Champ in-the-making
Champ in-the-making
Do you have a getPays() method in your sub-class?

soeursourire
Champ in-the-making
Champ in-the-making
Yes I do.

soeursourire
Champ in-the-making
Champ in-the-making
Ah but it was in protected that's why it was not working.
Thanks!

soeursourire
Champ in-the-making
Champ in-the-making
But now the problem I have is to add a menu box to my page, I have the following error:

javax.portlet.PortletException: org.apache.jasper.JasperException: Value binding '#{MyNewUserWizard.names}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/wizard/new-user/my_person-properties.jsp][Class: javax.faces.component.html.HtmlForm,Id: person-props][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: handleMetaDataEvent_id25][Class: javax.faces.component.UISelectItems,Id: handleMetaDataEvent_id26]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null

Do you know what is this error?

Thanks.

soeursourire
Champ in-the-making
Champ in-the-making
And in users.jsp how does this code work?

<r:nodePath value="#{r.homeSpace}" disabled="true" showLeaf="true" />

Where is defined homeSpace? I cannot find it anywhere in code?

Thanks for help

soeursourire
Champ in-the-making
Champ in-the-making
arggg… help!

This init() function of NewUserWizard is called in startWizardForEdit but where is called this startWizardForEdit??

gavinc
Champ in-the-making
Champ in-the-making
Wizards are launched via an actionListener attribute on an action link, these are defined in the relevant JSP. For example the new space wizard is launched from browse.jsp with the following:

<a:actionLink value="#{msg.new_space}" image="/images/icons/create_space.gif" padding="4" action="createSpace" actionListener="#{NewSpaceDialog.startWizard}" id="link1" />

Or to start a wizard in edit mode you would use:

actionListener="#{NewSpaceDialog.startWizardForEdit}"

When iterating through lists of stuff "r" represents each individual node, which in turn is basically a Map of properties. Therefore r.homeSpace represents a property in a map. If you look at org.alfresco.web.bean.users.UsersBean you'll find the following line:

props.put("homeSpace", homeFolderNodeRef);

And you final question, this error is because you are not returning a List of SelectItem objects from your getNames() method.

Hope this all helps.

soeursourire
Champ in-the-making
Champ in-the-making
Thanks for your help.
So that means that if I want to display "pays" for each user in users.jsp and thus use r.pays I should add this code somewhere:

props.put("pays", paysNodeRef);

It seems that these homeSpace, userName, fullName …etc are not all defined in the same class, is it normal? How do I choose where to define my property?

And for the error on menu, I have already the function getNames():
public  List<SelectItem> getNames()
  {
     return this.userNames;
  }

I think the problem is that I define a sub_class of NewUserWizard, then inside I added the attributes userNames and userName and I rewrote the function init() that is called in startWizardForEdit and this startWizardForEdit is called in users.jsp but not in person-properties.jsp (where I am trying to add this menu) so I guess this function is never called and thus my list is null…?

Thanks again