4 Replies Latest reply on Mar 31, 2009 7:38 PM by sarfaraz Mandal

    Call to Struts action from richfaces

    sarfaraz Mandal Newbie

      Hi all,
      I request your assistance with integrating a seam application with an existing struts application.

      My requirement is to call a struts action on click of command button in richfaces (the command button may be a4j:commandbutton or h:commandbutton).

      Below is a code snippet:
      CODE SNIPPET ONE:

      <rich:modalPanel xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:riche="http://richfaces.org/rich"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:fn="http://java.sun.com/jsp/jstl/functions"
       xmlns:a4j="http://richfaces.org/a4j"
       id="#{panelcartID}" width="350" height="550">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="My wish list"></h:outputText>
       </h:panelGroup>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:graphicImage value="/close-button-large.gif" styleClass="hidelink" id="hidelinkForCart#{panelcartID}"/>
       <rich:componentControl for="#{panelcartID}" attachTo="hidelinkForCart#{panelcartID}" operation="hide" event="onclick"/>
       </h:panelGroup>
       </f:facet>
       <h:panelGrid columns="3" width="255">
       <h:outputText value="Style" styleClass="detaillabel"/>
       <h:outputText value="Color" styleClass="detaillabel"/>
       <h:outputText value=""/>
      
      
       <c:forEach var="cartItem" items="#{cartContent}" varStatus="status">
       <c:forEach var="colCodes" items="#{cartItem.value}">
       <h:outputText value="#{cartItem.key}" styleClass="label"/>
       <h:outputText value="#{colCodes}" styleClass="label"/>
       <a4j:commandButton value="Remove" actionListener="#{cartAction.removeItem}" reRender="#{cartID},noOfItem#{cartID},#{panelcartID}">
       <f:setPropertyActionListener value="#{cartItem.key}" target="#{cartAction.itemKey}" />
       <f:setPropertyActionListener value="#{colCodes}" target="#{cartAction.itemColor}" />
       </a4j:commandButton>
       </c:forEach>
       </c:forEach>
       </h:panelGrid>
       <form name="campaignForm" method="post" id="campaignForm" action="http://localhost:8041/ordercapture/campaignLanding.do">
      
       <input type="hidden" name="campaignSnippet" id="campaignSnippet"
       value="#{cartAction.campaignSnippet}"/>
      
       <br/>
       <br />
       <h:panelGrid width="200" columns="3">
       <h:outputText value="" />
       <input type="submit" value="Enter quantities"/>
       <h:outputText value="" />
       </h:panelGrid>
       </form>
      
      
      </rich:modalPanel>
      


      What I am looking for in the above code is a replacement for the below mentioned code:

      CODE SNIPPET TWO
       <form name="campaignForm" method="post" id="campaignForm" action="http://localhost:8041/ordercapture/campaignLanding.do">
      
       <input type="hidden" name="campaignSnippet" id="campaignSnippet"
       value="#{cartAction.campaignSnippet}"/>
      
       <br/>
       <br />
       <h:panelGrid width="200" columns="3">
       <h:outputText value="" />
       <input type="submit" value="Enter quantities"/>
       <h:outputText value="" />
       </h:panelGrid>
       </form>
      
      


      The reason why I am looking for replacement of CODE SNIPPET TWO from CODE SNIPPET ONE is because CODE SNIPPET ONE works fine in firefox but fails in IE.


      In richfaces or JSF, how can I mention an URL as value for action attribute.
      eg: <h:commandButton action="http://localhost:8041/ordercapture/campaignLanding.do" />

      Please let me know your observations and workarounds.

      Regards
      Sarfaraz