JSF onunload event
Hi all,
I have a JSF page form which i m calling a JavaScript function in the onload() event.Similarly i need to call a JavaScript function when the user closes the form(unload event).
Is there any way..??
Following is my code..
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Sample Page</title>
</head>
<body>
<ui:composition>
<script language="JavaScript" type="text/javascript">
updateHeader('#{bean.value}');
</script>
<h:outputText id="id" value=""/>
</ui:composition>
</body>
</html>Thanks
Edited by: disha86 on Dec 2, 2011 2:28 PM
onunload="script ...", but that's a DHTML/Javascript question really not a Java question.
Similar Messages
-
I want the user to log off as soon as the browser is closed..
For it i m firing an onunload event in the body tag..
this thing is working fine in Windows XP but not in 2000
My code is
function closeWindow()
if(boolCloseWindow != "false")
document.frmChgPwd.requestid.value = "LGF000";
document.frmChgPwd.submit();
return false;
I m calling this function like this
<body onunload="return closeWindow()">
boolCloseWindow is a flag that i m setting to check some conditions
when i call this event a requestid is set and the form is submitted to a servlet where the servlet does the task of deleting the record from the database.
but its not working in Windows 2000
please helpDear Professional,
Good Morning. Are you looking for CMM Level - 5 or onsite oppertunity. Here are the correct match for you. Just send your updated profile to this id: [email protected]
Also do let us know, if any of your friends intrested for this oppertunity.
Regards,
Swathi. -
Onunload event not firing on firefox 27.0.1
when i close firefox browser Onunload event is not firing
Thanks, I filled a bug:
* https://bugzilla.mozilla.org/show_bug.cgi?id=974383 -
Submit processing with javascript "onUnload" event
Hi there,
I want a page to save its state regardless of how the user exits the page. Using page tabs, which have direct URLs, it seems the only way to do this is to use a javascript "onUnload" event which calls doSubmit(). The problem with this is that the submission requires a branch. Obviously, I don't want to branch the page; a destination has already been set. Telling the branch the is impossible as there is no way to access the destination URL for an onUnload event (understandably; it would be a serious breach of privacy.)
So, the question I have is: is there any way to get a call to doSubmit() (or similar) to process the page, but not branch afterwards?
Many thanks,
RobertRobert,
Take a look at the following thread -
Re: clean page items when user leaves a page
Whilst that thread deals with clearing items when the user leaves a page, it illustrates the issues of trying to capture the event of the user 'leaving' the page (after all 'leaving the page' could mean that they navigate to Google instead).
An alternative way would not to try and capture the 'leaving event' but to store the values in session state automatically (perhaps using some of Carl's Ajax examples) when the user types them in, then have an application process that runs on every page that determines whether those values need to be written to the database or not.
As an aside...I've heard of this requirement coming up quite a few times and I always question the logic behind it....since for every method that you can come up with as a way of forcing my input to be saved, I can come up with a way that will prevent it from working....until eventually we just reach the stage where I stand up and switch the machine off ;) -
We are recording the events raised by html elements on the IE browser through the IWebBrowser2 and IHtmlelement interfaces.
However,we needed a similar mechanism for trapping the events raised by the JSF elements on the page.
What is the way to achieve this - either through javascript or COM interfaces.
Any pointers would be very helpful.
Thanks in advance.jsf components has valuechangelistener.. you can use it for trapping events
-
Regarding communication between JSF and applet.
Hi all,
I have to send a array of int value from JSF to the applet method and vice versa,
so how can I do that?
Is there any straight forward way is there?
Or I need to use javascript in between applet and JSF for communicating.
If this is case can give some links so that I can go through it.
What I need is, I have jsf table(grid) when I select a row from table, for the selected row I have to display selected row ID in applet and vice versa.
Any suggestion or links will be appreciated, thanks in advance.
Thanks
dayathanks and sorry for late reply, let me go through the link,
i have tried with JavaScript, i got stuck, i need to call a JavaScript method for JSF component event listener. I searched in Google but no help regarding same.
Actually what I need is, I have JSF Component i.e. GridView(Table) and applet in a page. And for each row selection in GridView(table) I need to call a javascript method (with column value), and vice versa.
Can you give suggestion or any link so that can proceed further.
and i am able to communicate between applet which are included in the page
Thanks
Daya -
Calling java application from jsp using onUnload
I have tried to find the answer to this by searching many jsp, js and java forums, but have not had much luck. I hope someone here can help out. I have written a jsp page that passes a sql string to a java application when it loads. That application creates an xml file (a report) and returns the filename, which is the target of an onclick event. What I want to do, is to delete the file when the page unloads. I have written a separate application that will delete the file, but onclick and onunload events apparently only take JavaScript commands. I have tried to embed the jsp code into an onunload event, but it runs when the page is originally loaded. In addition, I created a separate jsp page that deletes the file, and I call that page onunload using window.open(). I can set that page to self.close(), but I can't get the page to not show itself. Even if I set the height and width to 0 (or 1), it seems to appear 100X100. Can anyone give me any suggestions on what to do in this situation? Thanks.
When my jsp page loads, I create the file using this code:
String filename = printtasktest.createxml(closed,encodedSQLString);
printtasktest is a java application on the server, that
creates a file on the server, and passes the filename back to the jsp page. Later I use this filename as a target of an onclick event:
<div class="button" onclick="printTask('<%=filename%>')">Print This Page</div>
printTask() is a javascript function that opens the printable page using window.print() and self.close().
The problem I have is that the file hangs around after, and I want to delete it when the user leaves the page. -
Hello everyone,
Even though this question has been answered before, I find that none of the answers seem to work for me.
My problem is the following: Locks are placed on records and tables at certain points in my application. But if the user simply closes the browser without closing the application properly, all the locks are still in place. So I need to catch an event that allows me to ABAP my way out of this.
I have the following BSP page which loads my application:
function startBSPApplication()
function endBSPApplication()
<frameset id="<%=guid %>_FRAMESET" rows="*,0" onload="startBSPApplication('<%=guid %>_A');" onunload="exitBSPApplication();" noresize framespacing="0" frameborder="0" border="0">
<frame name="<%=guid %>_A" src="session_default_frame.htm">
<noframes>This browser does not support frames.</noframes>
</frameset>
The start and end functions simply start and end a session, and I find myself unable to actually call an ABAP function in there. All ABAP code placed inside the javascript functions is called everytime the page is loaded, not everytime the function is called and that's not what I want.
I also already tried the <bsp:htmlbEvent> tag, but I couldn't get that to work either. I tried it like this:
Notice however that I wrote this on top of the frameset. Does this mean that the onunload event will be called twice and does this cause a problem?
I tried to call the onDestroy event from within my endBSP function, but nothing happened either.
<htmlb:content design="design2003" >
<htmlb:page title="Capture browser close " >
<htmlb:form>
<bsp:htmlbEvent id = "myid"
onClick = "onDestroy"
name = "onDestroy"/>
<script for="window" event="onunload" type="text/javascript">
alert('Starting the Server Event');
onDestroy();
</script>
</htmlb:form>
</htmlb:page>
</htmlb:content>
Does anybody have another suggestion, or notice me overlooking something?
Thank you in advance,
Niels.Hi Eddy,
I can't find anything really helpful in that blog. Except maybe adding the onbeforeunload attribute to my frameset and calling a JS function to back it up.
The problem still persists that any ABAP you put in a JS function is executed regardless of wether or not the function is actually called.
I need to get to my DO_HANDLE_EVENT somehow when the user closes the window. -
Hi experts,
i want to have an OnUnload event within my BSP
but I only know a OnLoad attribut in the <htmlb:documentBody>.
Is it possible to do a OnUnload?
For example: "Do you really want to leave this page?" -Yes-No Case (I'm familiar with the JS Part)
kind regards
MarcusHi everyone,
now the problem is solved.
I did it with an iFrame on an normal html-site.
<htmlb:content design="design2003">
<htmlb:document>
<htmlb:documentHead>
<SIEHTMLB:textEditHeader/>
<script language="JavaScript">
var needToConfirm = true;
window.onbeforeunload = confirmExit;
function confirmExit()
if (needToConfirm)
return "This will close the application!";
</script>
</htmlb:documentHead>
<htmlb:documentBody>
<iframe src="main.do"
name="NameApplication" width="100%" height="100%" marginheight="0" marginwidth="0" align="center">
<p>Your Browser cannot show embedded Frames</p>
</iframe>
</htmlb:documentBody>
</htmlb:document>
</htmlb:content>
Thats all --- Thanks for every answer!
Regards,
Marcus
Message was edited by: Marcus Pohl -
Can JFC handle all event of html element
I was just going through with JSF spec.
I have some doubts .
Can JSF hanlde all the events related to html element like key down , onclick etc, on form load.
Instead of writing heavy javascripts for this on client , can i handle all this on server side with JSF.
In my application , for each html field, we make server trip. To handle these html events , we are dependent on javascript. we don't use any fancy Elememnt.
My concern is this ,
by using JSF can i avoid this javascript coding on html event. and use JSF element with server side event handling .
thanksIf I understand your question, you're asking whether JSF component event handling can be done on the server side, rather than through the use of client side javascript.
The answer, I suppose is yes; you'd write server side code that is run during an appropriate phase in the life-cycle after data is submitted to the server.
However, I don't see much point in doing this. You're bound to create less scalable applications. If you're disgruntled about javascript, consider designing a set of JSF components based on XForms (provided you have an appropriate browser plug-in).
Rob -
On Browsers refresh/ back button event terminate user session
I have a problem pls help me to solve this.
Requirement is :
I need to catch browser's [b]refresh back button event.
Actually I need to terminate his session/login
when user clicks on browser's refresh button
and send user on Login page something like banking application(e.g. ICICI Bank) when u logged in ICICI bank side in between if u click on browser's refresh it shows message "Your session terminated " something like that.
So i want same functinality after user click on Refresh terminate his sessionin my page i am inserting new data and updating existing data
so for inserting data againe page get submitted so for inserrion time alos these onload & Onunload events get fired
i tried this but still proble is unsolved..
give some more ways to solve this -
PlEASE HELP EASY QUESTION: unload event is not firing at all.
Hi, onUnload event is not firing in Safari browser. I tried with different ways to capture that event but i failed to capture that event. So please help me on this, give suggestions to capture that event. Or any other event is firing when window is closing. Actually, i need to execute when window is closing. But in Safari the window is closing without firing of any events.
Safari doesn't execute the unLoad action when closing windows, period!
It only executes it when loading another page.
I might be wrong but I think Safari doesn't allow you to close a window with Javascript at all. All close events are blocked.
Maybe a SWF file can do it somehow. But I'm not sure... -
How to catch browser close event excluding navigation events
Hi,
I tried using onBeforeUnload event and onUnload events.. but they are catching navigation events within the same site. Could you please let me know how I can catch browser close events without catching Navigation events?
Thanks.Just set them to null when navigation takes place.
Said that, you should be asking Javascript/DHTML related questions in a forum devoted to Javascript/DHTML. There are ones at webdeveloper.com and dynamicdrive.com. This has nothing to do with Java. -
HTML5 Widgets - does the onUnload function ever fire?
The documentation for HTML5 widgets (Captivate 6 help) says that we can unload the widget via this function that is called by Captivate:
//To unload your widget onUnload:
onUnload: function()
/*Unload your widget here*/
I was having problems with the widget and some of these led me to wonder if this function was being called. I have tried on both Ipad and browser setting a breakpoint here and the code I have written never seems to be called.
I have also put in code to write to the console and it isn't happening.
Does anyone know if I'm doing something wrong - do I need to attach an event handler to the captivate object - I had assumed it would just be called in the same way as onLoad. If not, does anyone know how else I might intercept the unloading of the widget (give the documentation warns against trying to do it by attaching to native onunload events)? This is becoming an urgent problem for me so I would be hugely grateful for any advice.I tried attaching to native onunload events and had some problems making it work. It may have been my implementation, but I couldn't attach to onunload and have my widget still in existence to handle it. In case it is useful for others what I ended up using, and it seems to do the trick, is attach to Captivate's Slide Exit Event - which worked for my case but maybe not for all:
this .eventDisp = this.movieProps.eventDispatcher;
this .eventDisp.addEventListener(this.eventDisp.SLIDE_EXIT_EVENT, this.onExitSlide, this); -
Hi,
I am having an issue with onunload function.
Currently I have a page contains textfield, checkbox and select box. If there is a field value changes, when user leaves the page, there should be a warning message like "Do you want to save the change?" with ok and cancel button.
On the page, In each field, I added
onchange="setflag();"
In HTML body, I added
onunload = "validatepageexit();"
In HTML head, there is a function
function setflag()
$x('P0_PAGE_MODIFIED').value = 'Y';
function validatepageexit()
if (document.wwv_flow.P0_PAGE_MODIFIED.value == 'Y')
if (confirm('Do you want to save the changes?'))
doSubmit();
return true;
else
return false;
else
return false;
Now if I click other tabs without saving the changes, the popup message appears and it works properly. However, when I try to navigate other pages by changing URL, the message doesn't show up.
By the way, it seems working only on select box.
Any idea?Hi,
The javascript onchange="setflag();" should work on all your items... make sure you put the code at the right place.
The onunload event should only be triggered when the page do a "unload" action(goto another page), changing the url in the browser can't trigger the page unload action because it's not the same context...
think about page action/event and browser action/event... it's not the same thing!
if you do refresh on the browser, the onunload event won't be triggered
Louis-Guillaume
Homepage : http://www.insum.ca
Blog : http://insum-apex.blogspot.com
Maybe you are looking for
-
Can we run a java application using Runtime.exec()?
Can we run a java application using Runtime.exec()? If yes what should i use "java" or "javaw", and which way? r.exec("java","xyz.class");
-
I have created a fillable form and when the user fills in the fields and hits the email button only the check box fields are captured in the XML. How do I get it to include all data from the form in the XML export?
-
Can CS6 exploit the GPU on my desktop when accessed from my laptop with RDP?
Just to clarify further: both machines running windows 7 professional or better (so the full version of RDP is available), and CS6 runiing on the desktop, accessed from my laptop. As the GPU is being used as a compute resource, will CS use the deskto
-
gfAfter upgrading to awesome 3.5 I'm experiencing random X crashes (with SLIM, if that matters). /var/log/slim.conf sports repeated "unexpected signal 15", but I don't know if it is related. Problem seems related to this thread, but doesn't contain a
-
Standalone OC4J 9.0.4 - Loading sapsoext.dll - Unsatisfied Link Error
Hi, I was trying web based ssosample.jsp in a Standalone OC4J 9.0.4. The problem i am facing is java.lang.UnsatisfiedLinkError:getVersion() The call to load sapsoext.dll via System.loadLibrary() is successful. However when I attempt to call any metho