It seems that I had to change the web.xml to declare the elements necessary to 
a MyFaces webapp.  I think the examples don't require them because they have 
them declared elsewhere in JBoss Portal?  But for some reason it started 
navigating properly between portlets when I used this:


  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <web-app id="web-app_1" xmlns="http://java.sun.com/xml/ns/j2ee";
  |     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  |     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
  |     version="2.4">
  |     
  |     <context-param>
  |             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  |             <param-value>client</param-value>
  |     </context-param>
  | 
  |     <context-param>
  |             <param-name>javax.faces.application.CONFIG_FILES</param-name>
  |             <param-value>/WEB-INF/faces-config.xml</param-value>
  |     </context-param>
  | 
  |     <listener>
  |             <listener-class>
  |                     org.apache.myfaces.webapp.StartupServletContextListener
  |             </listener-class>
  |     </listener>
  | 
  |     <!-- Faces Servlet -->
  |     <servlet>
  |             <servlet-name>Faces Servlet</servlet-name>
  |                   
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  |             <load-on-startup>1</load-on-startup>
  |     </servlet>
  | 
  |     <!-- Faces Servlet Mapping -->
  |     <servlet-mapping>
  |             <servlet-name>Faces Servlet</servlet-name>
  |             <url-pattern>*.faces</url-pattern>
  |     </servlet-mapping>
  | 
  | </web-app>
  | 

Maybe it is the STATE_SAVING_METHOD being set to client?  The way I'm seeing 
this is that even though it is deployed as one SAR, each portlet is deployed as 
a separate application.  So when I set it to client, MyFaces embeds the 
appropriate values in the page itself, instead of server-side, so the 
destination portlet gets page parameters that help it navigate opposed to 
request attributes, which it cannot see since they are different apps? 

But this doesn't seem to handle the case when you need to pass parameters, or 
ideally, managed-beans across.  I can't even get regular parameters to go 
across (or at least how to access them).  Any ideas?

Navigation still doesn't work when it references something from a managed bean, 
for example, I get this in the log if I click on it:


  | link:
  |                     <h:form>
  |                             <h:commandLink action="addItem">
  |                                     <f:param name="mainPortlet" 
value="true" />
  |                                     <f:param name="urlVal" 
value="#{item.url}" />
  |                                     <f:verbatim>Add</f:verbatim>
  |                             </h:commandLink>
  |                     </h:form>
  | 
  | log:
  | 10:15:33,218 INFO  [[/query-portlet]] WARNING: Component jbpa61aafa8_id26 
just got an automatic id, because there was no id assigned yet. If this 
component was created dynamically (i.e. not by a JSP tag) you should assign it 
an explicit static id or assign it the id you get from the createUniqueId from 
the current UIViewRoot component right after creation!
  | 

...and the navigation goes to the from-view-id instead of the to-view-id.  When 
looking this warning up, I get advice from non-portlet applications, to set the 
ID if you generate it using Java code.  I imagine it reacts like this because 
the destination portlet is unaware of any JSF actions and managed beans that 
the source portlet has.  

So my questions are: 
- Do separate FacesContext objects exists for each portlet, or are they shared? 
 
- If they are shared, can we have the portlets view the same managed-beans by 
setting id's?  
- How do I pass and retrieve parameters from one portlet to another using JSTL 
and/or JSF tags?
- Are all these assumptions close to reality?  Or am I way off?



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982110#3982110

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982110
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to