Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing a layer from jsp scriptlet

 
Nasir Khan
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i access a layer from a jsp scriptlet?For example
<layer id="test" width=80px height=80px></layer>
<%@ page language="java" %>
<%
// here i wanna access the layer,like test.bgColor="blue"
%>
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can access the layer from generated JavaScript, but not while running the Java code which generates it. Remember that the code between the <% and %> is run on the server, and any JavaScript outside those marks is run on the client, long after the page has been generated.
 
Nasir Khan
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frank,
It means jsp can only be used for page generation.After page has been loaded we have to use client-side script like javaScript to change the content of the page.Am I right?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's it. JSP is just a way of generating a servlet which runs on the server to generate some HTML, which is then sent to the browser for display.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to trip alot of people up. I suggest you start by making a prototype page in HTML to get all the Javascript, etc. right, using dummy data for things you want the servlet / JSP to generate. When that is working, try to convert it to JSP.
Otherwise you are debugging too many things at once.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic