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 1014227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:13:20+00:00 2026-05-16T10:13:20+00:00

How do I pass Javascript variable to and JSTL? <script> var name = john;

  • 0

How do I pass Javascript variable to and JSTL?

<script>

    var name = "john";  

    <jsp:setProperty name="emp" property="firstName" value=" "/>   // How do I set javascript variable(name) value here ?

    <c:set var="firstName" value=""/>  // How do I set javascript variable (name) value here ?     

  </script>
  • 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-16T10:13:20+00:00Added an answer on May 16, 2026 at 10:13 am

    You need to send it as a request parameter. One of the ways is populating a hidden input field.

    <script>document.getElementById('firstName').value = 'john';</script>
    <input type="hidden" id="firstName" name="firstName">
    

    This way you can get it in the server side as request parameter when the form is been submitted.

    <jsp:setProperty name="emp" property="firstName" value="${param.firstName}" />
    

    An alternative way is using Ajax, but that’s a completely new story/answer at its own.

    See also:

    • Communication between Java/JSP/JSF and JavaScript
    • Your previous question regarding the subject
    • Your other previous question regarding the subject

    If you can’t seem to find your previously asked questions back, head to your user profile!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the best way to pass in the value held in a javascript variable
How can I pass a variable value from a template using JavaScript without using
I am trying to pass the value of a javascript variable to a php
Possible Duplicate: Pass a PHP string to a Javascript variable (including escaping newlines) Hy,
how to pass variable from zf to javascript/jquery? thanks
I need to pass a variable to a javascript function,but I got a little
I am going to pass an variable from asp.net server to the javascript but
Is there a way to pass a variable into a regex in jQuery/Javascript? I
I am trying to pass a php variable into a java script window.location that
My website has a javascript variable (addselectedsubdivision) that loads a neighborhood name from a

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.