This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes I need to open a popup from a jsf page. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "I need to open a popup from a jsf page." Watch "I need to open a popup from a jsf page." New topic
Author

I need to open a popup from a jsf page.

Hozaifa Azmi
Greenhorn

Joined: Jan 03, 2009
Posts: 22
Hi All...


I need to open a popup from a jsf page.
I tried with h:commandlink.
it is working, but i m getting the old values displayed in the popup.

Actually what i am doing is that--
My application has a datatable and one column has h:commandlink (Status: Assinged/Unassinged)
on click on that i need to interact with database and open a popup which will show the details of the particular Assinged user.
in the popup in a tabular format.

i m getting the popup on clicking the Status link, but i m getting the old values displayed in the popup.
i m getting the right results if i m clicking that link again.

So, how can i get the right results in one click only ???

I think, on clicking the link popup is displayd first & the method to get user details from the database is executed next.


How can i implement these in JSf.



Please help.

Thanks in advance.
Kumaresh Vidhyasagar
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
If you are using the same popup for all links, then reset the values in the popup when you are closing it. It might work!
Hozaifa Azmi
Greenhorn

Joined: Jan 03, 2009
Posts: 22
dear friend...

thanks a lot 4 the reply.

now, i am getting the popup;
but, first time i m getting the blank popup, on pressing F5 button i m getting the popup populated with values.

so, how can i get the popup populated with values in the first click only.


waiting 4 your quick response....


thanks in advance.
Kumaresh Vidhyasagar
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Can you share your code where you have problem with? So that I can quickly review and help you on this.
Hiren Dutta
Greenhorn

Joined: Dec 30, 2005
Posts: 10
If you are trying to open Popup on link click try to use <h: outputLink> instead of <h:commandLink> and use onclick event to open Popup....

<h: outputLink onclick="window.open('http://www.google.com', 'WindowName', 'dependent=yes, menubar=no, toolbar=no'); return false;" value="#">
<h: outputText value="popup" />
</h: outputLink>
Hozaifa Azmi
Greenhorn

Joined: Jan 03, 2009
Posts: 22
I am getting the popup using commandLink;
But, I am getting blank popup on clicking the link first time;
I am getting the right results if I again click the link or refresh the popup.

So, how I can I get the right results in the first click only ?

Since I have to do some process before opening up popup;
I want to invoke one backing bean method;
Below is my code:

<h:commandLink id="Status" onclick="window.open("projectDetails.jsp","",'width=700,height=400,top=100,left=100');"
actionListener="#{AdminSearchUserMB.check}"
value="#{item.userStatus}" immediate="true"
>
<f:param name="mailId" value="#{item.mailId}" />
</h:commandLink>

please help.
Kumaresh Vidhyasagar
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Remove the attribute immediate=true and try it.
Hozaifa Azmi
Greenhorn

Joined: Jan 03, 2009
Posts: 22
I have tried after removing immediate="true" ;
still it's not working
Kumaresh Vidhyasagar
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Please share your backend bean code.
Hozaifa Azmi
Greenhorn

Joined: Jan 03, 2009
Posts: 22
Since, I am unable to post the code;
I have sent it to your e-mail id;
please check.

thanks,
hozaifa.
Kumaresh Vidhyasagar
Ranch Hand

Joined: Dec 05, 2008
Posts: 30
Sorry...I want to have a look at the code where the mappings of the values are happening in the projectDetails.jsp
Hozaifa Azmi
Greenhorn

Joined: Jan 03, 2009
Posts: 22
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<f:view>
<f:loadBundle basename="com.opmt.admin.common.messages" var="message" />

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<head>
<title>Project Details...</title>
<link href="style3.css" rel="stylesheet" type="text/css" />
</head>
<body>

<center><br>
<br>
<h:outputText value="Project Details"
style="color:green; font-weight:bold" /><br>
<br>
<br>
<br>

<h:form>
<h:dataTable id="dt2" value="#{AdminSearchUserMB.projectDetailsTOArray}"
border="2" cellpadding="0" cellspacing="0" var="item2">

<h:column>
<f:facet name="header">
<h:outputText value="User ID" style="color:red; font-weight:bold" />
</f:facet>
<h:outputText value="#{item2.userId}" />
</h:column>

<h:column>
<f:facet name="header">
<h:outputText value="Project Name"
style="color:red; font-weight:bold" />
</f:facet>
<h:outputText value="#{item2.projectName}" />
</h:column>

<h:column>
<f:facet name="header">
<h:outputText value="Customer Name"
style="color:red; font-weight:bold" />
</f:facet>
<h:outputText value="#{item2.customerName}" />
</h:column>

<h:column>
<f:facet name="header">
<h:outputText value="E-mail ID" style="color:red; font-weight:bold" />
</f:facet>
<h:outputText value="#{item2.mailId}" />
</h:column>

</h:dataTable>
<br>
<br>
<br><br>
<form method="post"><input type="image" src="images/close.jpg"
alt="Close!" value="Close!" onclick="window.close()"></form>

</h:form></center>

</f:view>
</html>
Zafar Hakim
Greenhorn

Joined: Nov 04, 2008
Posts: 6
Does any one know solution to this problem. I too am facing similar problem.

Problem:
I have a page with data table --- I open a new modal dialog window (window.showModalDialog) on click of menu item on a page --> It opens the page to view details of the selected item --- When I close it and select different row of the table(in the first page) and open to see the details it shows the previous data.

The data on the form fields are populated from a backing bean which is session scoped. I am sure the backing bean is updated with new data(checked it while debug ). Only that it is not displayed/refreshed in the page rendered.

Thanks for your time and hoping to get your feedback on this.

Regards,
Hakim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I need to open a popup from a jsf page.
 
Similar Threads
Popupwindow using commandlink
Opening popUp window in JSF
dealing with caching in IE
Popup to parent communications
jsf page refresh