Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 507531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:48:50+00:00 2026-05-13T06:48:50+00:00

hello i need to output a java variable inside a javascript call inside a

  • 0

hello i need to output a java variable inside a javascript call inside a tag inside a jsp !

for example:

 <% String param = "hello";%>

<dmf:checkbox  name="checkbox"
  onclick = "selectAll(<%=param%>)"
/>

the javascript generated is:

selectAll(<%=param%>),this); but I actually want something like

selectAllCheckBoxes(Hello),this);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:48:51+00:00Added an answer on May 13, 2026 at 6:48 am

    That’s not escaping. That’s just printing a scriptlet variable as if it is a JavaScript variable.

    Besides, your examples are confusing, they doesn’t match each other and the Javascript code is syntactically invalid. I can at least tell that JavaScript string variables are to be surrounded by quotes. If you want to end up with

    selectAllCheckBoxes('Hello', this);
    

    where Hello should be obtained as a value of the scriptlet local name variable (the param is a reserved variable name, you shouldn’t use it yourself), then you need to do

    selectAllCheckBoxes('<%= name %>', this);
    

    In the same way, if you want to end up with

    onclick="selectAll('Hello')"
    

    you need to do

    onclick="selectAll('<%= name %>')"
    

    That said, I strongly recommend you to stop using the old fashioned scriptlets which are been discouraged since more than a decade. JSP programmers were been recommended to use taglibs and EL only to make the JSP code more clean and robust and better maintainable. You can use taglibs such as JSTL to control the flow in the JSP page and you can use EL to access the “back-end” data. Your example can be replaced by:

    <c:set var="name" value="Hello" />
    
    ...
    
    selectAllCheckBoxes('${name}', this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 491k
  • Answers 491k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you're using display:table-row etc., then you need proper markup,… May 16, 2026 at 10:06 am
  • Editorial Team
    Editorial Team added an answer Well, I couldn't figure out how to get the fixtures… May 16, 2026 at 10:06 am
  • Editorial Team
    Editorial Team added an answer You can always check what query subsonic generates for you… May 16, 2026 at 10:06 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Hello I've written small class in java to read in xml file as a
I have some MATLAB code and some Java code that need to talk with
Hello I need to generate a report which would include both data and a
I am currently writing a template for OpenCms, a Java based CMS with a
I am building a client server application using Java Sockets (in Windows XP). For
Since I've been learning Java, I've been able to create GUI programs. However, even
I'm making a C Assessment Program through Java, which has a bunch of programming
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.mail.event.*; import java.net.*;
Hello every one. I'm faced with a weird problem. My application has a simple
Hello I am using jquery layout plugin from http://layout.jquery-dev.net/ . my options are following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.