2014-06-16 35 views
0

我知道如何创建JSF 2.0 servlet,并且知道如何创建portlet,但是我在组合这两种技术时遇到了问题。我的JSF portlet运行良好,直到我必须通过<h:commandLink />调用我的支持bean的方法。当我点击这些链接时,当前页面被重新加载并且没有方法被调用。我想我的应用程序需要一些额外的配置。需要为了得到这样的工作命令链接做什么:Websphere中的JSF 2.0驱动portlet - 如何实现命令链接

<h:commandLink action="#{backingBean.doSomething}" /> 

请注意,我用的WebSphere 8门户服务器提供了一个JSF 2.0 portlet的桥梁。

编辑

我在这里看到一个基本的矛盾:

  • 的Portlet API负责生成的URL - 生成有效的门户网站的URL
  • JSF负责生成的URL - 生成有效的JSF -URL

我的托管bean使用注释进行配置:

@ManagedBean(name = "backingBean") 
@ViewScoped 
public class entryEditController 
{ 
    public String doSomething() 
    { 
     return "result.xhtml"; 
    } 
} 

这是我的faces-config.xml中

<?xml version="1.0" encoding="UTF-8"?> 
    <faces-config 
      xmlns="http://java.sun.com/xml/ns/javaee" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" 
      version="2.0"> 
     <application> 
      <view-handler>com.ibm.faces20.portlet.FaceletPortletViewHandler</view-handler> 
      <el-resolver>com.ibm.faces20.portlet.PortletELResolver</el-resolver> 
      <resource-handler>com.ibm.faces20.portlet.httpbridge.PortletResourceHandler</resource-handler> 
     </application> 
    </faces-config> 
+0

你有没有使用配置了托管bean注释或XML中的faces-config.xml?请包含更多信息 – zargarf

回答

0
  1. 更新到WAS 8.0.0.8
  2. 如果你的bean是@SessionScoped@ViewScoped你必须把它添加到您的网页。 xml:

    <context-param> 
        <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name> 
        <param-value>false</param-value> 
    </context-param> 
    
  3. 在步骤2之前,我添加了一个新的命令按钮无效的操作值。这导致验证错误。在验证错误,不执行命令=>确保没有任何验证错误,例如通过增加<h:messages />到您的模板
  4. 阅读这样的回答:https://stackoverflow.com/a/2120183/395879
相关问题