Execute Javascript from our JAVA code

Hi all,

I have a question:

It's possible to execute a javascript code from the back bean page. For example , we execute a button action (Conect to a db, insert data) and if all it's ok we execute a simple alert ("The insert is ok!!");

Any way to do this?

Thx!

[292 byte] By [Jandera] at [2007-11-27 10:54:06]
# 1

I don't know enough about Javascript, but I don't think it can be executed from within Java code.

If you can't, an alternative is to provide a status code and/or status message that is accessible to the page. There are a number of ways to do this. One option is to put the information in a hidden field. Another option is to put the information in a session bean and add appropriate JSP code to your page to get that information.

You can link a Javascript function to the page's onLoad event. The function can get the status code/status message and create the alert.

Futeleufu_Johna at 2007-7-29 11:48:16 > top of Java-index,Development Tools,Java Tools...