This content has been marked as final.
Show 2 replies
-
1. Re: How to open a pop window
fmarwede Sep 28, 2007 9:06 AM (in response to kaviarasu)Hi,
do you know the richfaces modal panels?
http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf -
2. Re: How to open a pop window
marc1 Oct 1, 2007 7:37 AM (in response to kaviarasu)IMHO the richfaces modalpanel implementation is still very unstable and not ready yet for production use. so, if you dont really need it, avoid modal panels at all (of course we need them in my project, and therefore are forced to use them ;-) ..)
anyway, to open a panel window using js, write your openwindow() function and save it in a separate .js file, then import it using <a4j:import ..> .other combinations may not work. then check the doc for <a4j:..> tags which support things like oncomplete="openwindow()", onsubmit="..", etc, depending on what you want to do.
mysample.js (notice the mywindow.jsf for .xhtml files):function openwindow() { .... popUpWin = window.open("./mywindow.jsf", "mypopUpWin", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width=400,height=50"); .. }
and this would be the .xhtml that fires the openwindow():<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jstl/core" xmlns:a4j="http://richfaces.org/a4j" > <f:view contentType="text/html"> <body> <ui:composition template="template.xhtml"> <ui:define name="main-content"> <fieldset> <a4j:loadScript src="./mysample.js"/> .. your code.. <h:commandLink immediate="true" image="Adobe.gif" style="cursor:pointer" actionListener="#{some.listener}" onclick="javascript:openwindow()"> <h:graphicImage value="./Images/Adobe.gif" /> <f:attribute name="param1" value="#{somebean.param1}" /> </h:commandLink>
the above works for richfaces and regular jsf tags. you can also fire richfaces scripts using <a4j:jsScript..>
marcelo