Geeta, thanks for your reply, I’ve solved using the following approach:

 

<h:commandLink id="dTSearch" styleClass="aSearch" onclick="window.open('DocumentTypes.faces','','width=200,height=300,top=100,left=100')">

    <h:outputText value="Find DocType"/>

    <f:param name="activeFolder" value="#{documentBean.activeFolderName}"/>

  </h:commandLink>

 

The problem I’m having is that when a link is clicked in the new window with some value, I want that value to fill up an h:inputText in the main page which called the new window.

 

In the new window I’m doing something like this:

 

<h:commandLink immediate="true" action="" class=SpellE>documentHandler.selectDocumentType}" onclick="_javascript_:window.close();">

            <h:outputText value="#{node.description}" styleClass="nodeFolder"/>

            <h:outputText value=" (#{node.childCount})" styleClass="childCount" rendered="#{!empty node.children}"/>

                                                                        <f:param name="selectedDocType" value="#{node.description}"/>

</h:commandLink>

 

and in the documentHandler.selectDocumentType I’m setting the value in the property bound to the h:inputText , but the main page is never refreshed so the change is not made.

 

Did you have a similar problem?

 

Thanks a lot

 

Matias

 

 

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 03, 2006 12:45 PM
To: MyFaces Discussion
Subject: Re: Open new browser window.

 


"Matias Gomez Carabias" <[EMAIL PROTECTED]> wrote on 01/03/2006 10:41:38 AM:

> Hi guys, I need a tip on how to open a new window, let's say via an
> commandLink or outputLink with parameters, and set some properties to
> the new page, such as scrollbars=no, height, width, etc...
> If I have to do this via _javascript_, hoy can I pass the parameters and
> call a backingBean?
> The idea is the following, pass some parameters to a backing bean via
> the f:param and call a backingBean method, and after the method is
> executed, to open a new window but with the properties described above.
>
>
> Thanks a lot for your help
>
> Matias

Hi Matias,

I do some of what you are describing. Here's my code (and I have tried to simplify it for clarity):

My "nextAssignment.jsp" has:
<h:commandLink rendered="#{worklist$nextAssignmentHome1.currentActivityInAgentsSwimLane}"
        action="#{worklist$nextAssignmentHome1.acceptAssignment}"
        immediate="true">
        <h:outputText
                value="#{rowIndexVariable+1}. #{assignment.urlDisplay}" />
</h:commandLink>

My backing bean (corresponding to #{worklist$nextAssignmentHome1) does its work in acceptAssignment() method and returns a String "twowindows" which is mapped to a jsp (via tiles etc.) to a jsp with this code:

<script language="_javascript_" type="text/_javascript_">
<!--
/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}

function popUpAssessment(mypage){
        NewWindow(mypage,'Assessment','600','800','yes','center');
}



var assessmentWindow;
var assessmentWindowUrl = "<h:outputText  escape="false" value="#{twoWindows1.processLight.nextUrl.url}" />";
var cval = "<h:outputText value="#{twoWindows1.processLight.urlCount}" />";
// -->
</script>

</head>
        <body onLoad="popUpAssessment(assessmentWindowUrl)";>

etc.

Hope this helps you towards a solution to your problem.

Regards,
Geeta

Reply via email to