"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