You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matias Gomez Carabias <ma...@nixor.com.ar> on 2006/01/03 14:41:38 UTC

Open new browser window.

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


Re: Open new browser window.

Posted by Dave Brondsema <da...@brondsema.net>.
Matias Gomez Carabias wrote:
> 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
>

Take a look at the "Popup family" components from http://www.jenia.org/

--
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
                <><

Re: Open new browser window.

Posted by gr...@intellicare.com.
"Matias Gomez Carabias" <ma...@nixor.com.ar> 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