You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sulabha Walavalkar <s....@zensar.in> on 2008/10/07 15:18:23 UTC

How to call javascript function on onload in struts-tiles

Hi,

 

I have a requirement as - on click of submit button call should be made to
database to check if any batch processes are running or not.

If any batch process is running then a message should be displayed on the
same screen else the data should be displayed in new window.

 

Since I am using tiles and layout.jsp page, <body> tag contains in
layout.jsp.  How can I check the value set by action class in javascript
function on onLoad event and then decide whether to open new window or stay
on the same screen?

 

If anyone has come across this situation or have any idea, please reply.

 

Thanks & Regards,
Sulabha Walavalkar
----------------------------------------------------------------------------
--------
John Lewis Partnership, Zensar Technologies 
Zensar Knowledge Park, Plot#4, MIDC, 
Kharadi, Off Nagar Road, Pune - 411014
Landline :  +91-20-66074888           | +91-9765204544

 

Email      :   s.walvalkar@zensar.in    | website:  www.zensar.com
<http://www.zensar.com/> 

 


Re: How to call javascript function on onload in struts-tiles

Posted by Alberto Flores <af...@umd.edu>.
Use validation

Sulabha Walavalkar wrote:
> Hi,
> 
>  
> 
> I have a requirement as - on click of submit button call should be made to
> database to check if any batch processes are running or not.
> 
> If any batch process is running then a message should be displayed on the
> same screen else the data should be displayed in new window.
> 
>  
> 
> Since I am using tiles and layout.jsp page, <body> tag contains in
> layout.jsp.  How can I check the value set by action class in javascript
> function on onLoad event and then decide whether to open new window or stay
> on the same screen?
> 
>  
> 
> If anyone has come across this situation or have any idea, please reply.
> 
>  
> 
> Thanks & Regards,
> Sulabha Walavalkar
> ----------------------------------------------------------------------------
> --------
> John Lewis Partnership, Zensar Technologies 
> Zensar Knowledge Park, Plot#4, MIDC, 
> Kharadi, Off Nagar Road, Pune - 411014
> Landline :  +91-20-66074888           | +91-9765204544
> 
>  
> 
> Email      :   s.walvalkar@zensar.in    | website:  www.zensar.com
> <http://www.zensar.com/> 
> 
>  
> 
> 

-- 
--
Alberto
http://www.linkedin.com/in/aflores


Re: How to call javascript function on onload in struts-tiles

Posted by Dave Newton <ne...@yahoo.com>.
--- On Tue, 10/7/08, Sulabha Walavalkar wrote:
> I have a requirement as - on click of submit button call
> should be made to database to check if any batch processes 
> are running or not.
> 
> If any batch process is running then a message should be
> displayed on the same screen else the data should be displayed 
> in new window.
> 
> Since I am using tiles and layout.jsp page, <body>
> tag contains in layout.jsp.  How can I check the value set 
> by action class in javascript function on onLoad event and 
> then decide whether to open new window or stay on the same screen?

Personally I'd use Ajax to solve this, as a static version wouldn't be particularly accurate.

A trivial solution would be to set a JavaScript variable to the value of some action variable; this is done inside a JSP:

<script>
  var foo = <s:property value="isBatchRunning"/>;
  function checkOnSubmit() {
      if (foo) {
          // When running
      } else {
          // Not running
      }
  }
</script>

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org