Hello Everybody,

I am new to Tapestry 5, want to access the variables declared in Java class

on my Html page in Javascript.

My Java class file  contains

        @Persist
        private String var = "value";

        public String getVar() {
                return var;
        }
        
        public void setVar(String var) {
                this.var = var;
        }

I am accessing this variable on my html as below :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
<head>
<script language="javascript" type="text/javascript">
<!-- //
        function setvar() {             
                        var somevar = ${personal_on};
                        // also tried this one 
                        var somevar = "${personal_on}"; //sets
"${personal_on}" as string not its value
                        
                        //---
                        //---// some code here which uses above variable
//---
                        //---
                       
        }
// -->
</script>
</head>
<body onload="setup();">
 ---
</body>
</html>

This is giving javascript error Object not defined on loading of this html
page.

I think it not getting it as Tapestry variable in script tags under <head>.
If I use this variable in <body> tags it gets it value as in class.

Why this is happening? Am I missing something? 
Any help will be appreciated.. please help...

Thanks in advance...
-- 
View this message in context: 
http://www.nabble.com/T5-accessing-Java-class-variables-in-Javascript-tf4618529.html#a13190350
Sent from the Tapestry - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to