We can also pass the value from a JSP page to the java script as we have done in our previous example of passing values to the java script from the HTML page. Since in JSP page we can embed HTML tags as well.
In our this example of passing values from jsp page to java script we have created a function hello() which takes value from the jsp page on click of some button and then shows it through the alert().
Here is the example code of the JSP page which is passing value to the java script as follows:
PassJSP.jsp
<%@ page language="java" %>
|
Output:


If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Pass value from JSP to JavaScript View All Comments
Post your Comment