I have a jsp file a.jsp which has b.js now i want to pass a value from a.jsp which is come from a java function like <% patientmodel.getpatient()%> I need to pass the value of this function to a function in b.js any one suggest me plz

Assuming that you have this javascript function:

<head>
<script>
  function abc(arg) {
...
  }
</script>
</head>

And in the jsp you have:

<body>
<%
..
// get patientmodel
%>

<input type="button" name="but" value="Click me" onclick="abc('<%=patientmodel.getpatient()%>');" />

</body>

Or you can use it in any other way. But you cannot use javascript to change the value of java variable.

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.