- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 05:59 AM
Hi all,
I want to access a screen.height into jelly tag.
I am using the following code
<script>
var h11 = screen.height-280;
</script>
<j:set var="jvar_h1" value="${h11}"/>
<g:evaluate var="jvar_esh1" object="true" jelly="true">
var height123 = jelly.jvar_h1; //This is not working
</g:evaluate>
Can you please suggest me what is wrong I am doing here.
Thanks,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 06:03 AM
Hi Soumen,
Due to the architecture of Jelly, I don't think this is going to work for you. The code in the script tag is run on the client after the Jelly processing has already happened (on the server.)
The XML tags (Jelly) get turned in to HTML, JavaScript, and CSS then sent to the browser. Then your h11 variable is set with the screen.height-280 value. There is no further Jelly processing at that time, so you cannot set a Jelly variable from a client script due to the order in which they are executed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 06:03 AM
Hi Soumen,
Due to the architecture of Jelly, I don't think this is going to work for you. The code in the script tag is run on the client after the Jelly processing has already happened (on the server.)
The XML tags (Jelly) get turned in to HTML, JavaScript, and CSS then sent to the browser. Then your h11 variable is set with the screen.height-280 value. There is no further Jelly processing at that time, so you cannot set a Jelly variable from a client script due to the order in which they are executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 06:14 AM
Hi Chuck Tomasi
I understand this,I think for this reason we can access the a value of a variable from jelly tag to script tag and the reversible process is not possible.
Thanks for your quick reply.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 06:17 AM
Yes, you are correct.
You can use a jelly variable to create dynamic client scripts because that processing is done on the server before the client (browser) gets the content. The reverse is not true because all the Jelly processing is done by the time the client script is on the browser and running.