You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Namasivayam, Sudhakar (Cognizant)" <NS...@chn.cognizant.com> on 2004/01/14 12:01:46 UTC

java script + session Attribute

Hi all,
		I would wat to do client side validation based on a session attribute on a page. Should i put this value in a hidden value and access it or can i put it directly into the java scipt code ex.
   for(var i= 0; i< <%= session.getAttribute("Length") %>; i++)
{...
}

 is this possible?

thanks
sudhakar 

Re: java script + session Attribute

Posted by Mark Lowe <ma...@talk21.com>.
you don't need to declare i as a global variable

length = "<c:out value="${Length}" />";
or
length = "<bean:write property="Length" />";

for(i = 0;i < length;i++) {
..
}

only need to use
var foo = "bar";

if you need to reference the variable elsewhere.




On 14 Jan 2004, at 11:01, Namasivayam, Sudhakar (Cognizant) wrote:

> Hi all,
> 		I would wat to do client side validation based on a session  
> attribute on a page. Should i put this value in a hidden value and  
> access it or can i put it directly into the java scipt code ex.
>    for(var i= 0; i< <%= session.getAttribute("Length") %>; i++)
> {...
> }
>
>  is this possible?
>
> thanks
> sudhakar
> <InterScan_Disclaimer.txt>--------------------------------------------- 
> ------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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