how to use a java script variable on the same jsp page??

jsp is a servlet that runs on the server and produces output (usually an html page). JavaScript (and it is one word, and has nothing to do with java) runs on the client in the browser after the server has delivered it. There is no reason that what the jsp produces can't include javascript or a reference to a js file. IOW, the two have nothing to do with each other.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.