Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling a jsp:useBean method in Javascript

User_19BPUAug 30 2011 — edited Aug 30 2011
Hi,

I want to call a jsp:useBean method in Javascript. Like:-


<jsp:useBean id="StringEscapeUtils" class="org.apache.commons.lang.StringEscapeUtils" scope="application" />
<script>

var accountNumber = '<c:out value="${ACCOUNT_NUMBER}" />';

var accountNumberWithSingleQuote = "<%=StringEscapeUtils.escapeJavascriptString('<%=accountNumber%>')%>"; // not working

alert(accountNumberWithSingleQuote );

</script>

Here var accountNumberWithSingleQuote = "<%=StringEscapeUtils.escapeJavascriptString('<%=accountNumber%>')%>"; // not working

Here how to add the parameter accountNumber in the escapeJavascriptString() method?

Is it possible can we do it without scriptlet in JS? Pls. let me know your opinion.

thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2011
Added on Aug 30 2011
5 comments
1,876 views