4 Replies Latest reply on Sep 8, 2008 9:42 AM by Marine Wacheux

    Problem with 2 htmlCommandLink and target

    Marine Wacheux Newbie

      Hi,

      I have a problem with two (or more) htmlCommandLink in one form :
      - button A has a "target" property to open the result in a new window
      - button B has no "target" property

      Config : MyFaces 1.1.5 + RichFaces 3.1.6 + Firefox

      If I first click on button A, result open correctly in a new Firefox tab. But when I then click on button B (from first tab), result also open in a new tab, which should not happen.

      I didn't found any JIRA issue about this. Did I make a mistake in components usage, or should I open a new issue ?

      Thanks for help.
      Marine


      <h:form id="fImpr">
       <a4j:htmlCommandLink
       styleClass="BTN_LINK"
       action="#{compteRenduOperatoireController.imprimer}"
       target="#{sessionUtilisateurBean.targetAffichageDoc}"
       onclick="donnerFocusFenetre('#{sessionUtilisateurBean.targetAffichageDoc}');">
       <t:graphicImage value="#{ress.Img_Imprimer}"/>
       <rich:toolTip value="#{msgG.Imprimer}"/>
       </a4j:htmlCommandLink>
       <a4j:htmlCommandLink id="btnDiffusion" styleClass="BTN_LINK"
       action="#{compteRenduOperatoireController.accesEcranDiffusion}">
       <t:graphicImage value="#{ress.Img_Documents_DiffusionDocs}"/>
       <rich:toolTip value="#{msgO.CompteRenduOperatoire_DiffusionCRO}"/>
       </a4j:htmlCommandLink>
       <a4j:htmlCommandLink id="btnCloture" styleClass="BTN_LINK"
       action="#{compteRenduOperatoireController.terminer}">
       <t:graphicImage value="#{ress.Img_Documents_Cloture}"/>
       <rich:toolTip value="#{msgO.CompteRenduOperatoire_Cloture}"/>
       </a4j:htmlCommandLink>
      </h:form>
      


        • 1. Re: Problem with 2 htmlCommandLink and target
          Marine Wacheux Newbie

          I forgot to tell : if I separate htmlCommandLink components in 2 forms, then it works correctly.

          • 3. Re: Problem with 2 htmlCommandLink and target
            Marine Wacheux Newbie

            Thanks for your reply. Here is the bean code.

            For "#{sessionUtilisateurBean.targetAffichageDoc}" :

             public final static String TARGET_AFFICHAGE_DOC = "GCM_IMPR_DOC";
            
             public String getTargetAffichageDoc() {
             return TARGET_AFFICHAGE_DOC;
             }
            


            For "#{compteRenduOperatoireController.imprimer}" :
            public String imprimer() {
             Rdv rdv = rdvService.lireRdvById(f().getRdv().getId());
            
             Fichier f = null;
             try {
            
             f = docService.imprimerCourrierOuDocValide(rdv.getCompteRenduOperatoire().getId());
             FacesUtil.ecrireFichierReponseHttp(f.getContenu(), f.getType(),
             f.getNom(), false);
            
             } catch (DocumentException e) {
            
             addMessage(new MessageUtilisateur(e.getClefMessageUtilisateur(),
             GraviteMessage.ERROR, e.getParametresMessageUtilisateur()),
             WebKeys.BUNDLE_SERVICES.getKey());
             }
            
             return GcmKey.ECRAN_ACTUEL.getKey(); // Return an empty String.
            
             }


            For "#{compteRenduOperatoireController.accesEcranDiffusion}" :
            public String accesEcranDiffusion() {
             log.debug("accesEcranDiffusion");
            
             Map<WebKeys,Serializable> objetsATransmettre = f().getObjetsATransmettre();
             objetsATransmettre.put(WebKeys.PARAM_CRO_BEAN_CONTROLLER,
             f().getNomBeanControlleurEcranSuivant());
            
             DiffusionDocsPatientController ctl =
             (DiffusionDocsPatientController)getBean(DiffusionDocsPatientController.NOM_BEAN_CTRL);
             return ctl.initialiserFormPourDocument(
             f().getRdv().getCompteRenduOperatoire().getId(), NOM_BEAN_CTRL,
             objetsATransmettre);
            
             }


            For "#{compteRenduOperatoireController.terminer}" :
            public String terminer() {
            
             boolean ok = true;
            
             ModeleReponseServiceUI reponse;
             try {
             reponse = gestionDocService.modifierStatutDoc(
             f().getRdv().getCompteRenduOperatoire().getId(),
             StatutDocument.TERMINE);
             } catch (ReponseServiceUIException e) {
             reponse = e.getReponse();
             ok = false;
             }
             addMessage(reponse.getMessagesUtilisateurs(), WebKeys.BUNDLE_SERVICES.getKey());
            
             if (ok)
             return ecranSuivant();
             else
             return GcmKey.ECRAN_ACTUEL.getKey();
             }


            Thanks in advance for your help.

            • 4. Re: Problem with 2 htmlCommandLink and target
              Marine Wacheux Newbie

              I also have the same problem with 2 panelMenuItems in the same form.

              I created JIRA entry : https://jira.jboss.org/jira/browse/RF-4420