small update:

my faces-config snippet was "wrong"...
if i change the

  <managed-property>
      <property-name>uidString</property-name>
      <value>#{param.identifier}</value>
  </managed-property>

to

  <managed-property>
      <property-name>uidString</property-name>
      <value>#{requestScope.identifier}</value>
  </managed-property>

it's working fine.

This works for me for the moment, as all my pages are accessed via the navigation tree, but it looks like I would have to modify the tree navigation somehow if I needed to access the pages via direct links as well as via the tree ?

Regards,
Tom

Thomas Lutz wrote:
Hi list,

sorry, if this is obvious, but I couldn't find any help searching the archives and the "internet" and besides I am quite new to JSF.

I use a tree2 instance for navigation, basically a "public void selectNode(ActionEvent event)" method handles clicks on the tree, and then tries to call the correct page. For editing, a feature id should be added to the request, that is later injected in the backing bean as a managed property. And this is not working... in the backing beans property setter the parameter is null. Debugging I found that my parameter is there in the getRequestMap(), but not in the getRequestParameterMap()... Seems like I missed something, please help me :-).

If my problem is just a symptom and my "architecture" :-) or approach is wrong... don't hesitate to tell me :-)

Thanks in advance, regards,
Tom

---
Here some source snippets:

My tree clicked handler method:

public void selectNode(ActionEvent event) throws AbortProcessingException
   {
       UIComponent component = (UIComponent) event.getSource();
       while (!(component != null && component instanceof HtmlTree))
       {
           component = component.getParent();
       }
       if (component != null)
       {
           HtmlTree tree = (HtmlTree) component;
           TreeNodeBase node = (TreeNodeBase) tree.getNode();
           tree.setNodeSelected(event);

           // now handle parameters encoded in the identifier
           String nodeIdentifier = null;
           if (node.getIdentifier().contains("?"))
           {
// TODO this is hardcoded for the aerodrome only, request string to request hashmap parser needed here ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
               externalContext.getRequestMap().put("identifier", "4711");
nodeIdentifier = node.getIdentifier().substring(0,node.getIdentifier().indexOf("?"));
           }
           else
           {
               nodeIdentifier = node.getIdentifier();
           }

FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(FacesContext.getCurrentInstance(),null, nodeIdentifier);

       }
   }

---
Snippet from backing bean definition in faces-config:

<managed-bean>
   <managed-bean-name>testmodel</managed-bean-name>
<managed-bean-class>at.schnirkel.test.TestModelImpl</managed-bean-class>
   <managed-bean-scope>request</managed-bean-scope>
   <managed-property>
       <property-name>uidString</property-name>
       <value>#{param.identifier}</value>
   </managed-property>
   <managed-property>
       <property-name>hibernateService</property-name>
       <value>#{hibernateService}</value>
   </managed-property>
 </managed-bean>

---
The setter from the backing bean:
public void setUidString(String newValue)
   {
System.out.println("set uidstring was called with [" + newValue + "]"); Iterator iterator = FacesContext.getCurrentInstance().getExternalContext().getRequestMap().entrySet().iterator();
       while (iterator.hasNext())
       {
           Map.Entry entry = (Map.Entry) iterator.next();
System.out.println(entry.getKey() + " -> " + entry.getValue());
       }

ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
       System.out.println("---------------");
System.out.println(externalContext.getRequestMap().get("identifier")); System.out.println(externalContext.getRequestParameterMap().get("identifier"));

       this.uidString = newValue;
   }


Reply via email to