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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:02:59+00:00 2026-06-11T15:02:59+00:00

In my jsp, I would show a message when I select an option, this

  • 0

In my jsp, I would show a message when I select an option, this message is loaded from a properties files. For example:

In props I have:

 msg.01=Message 1
 msg.02=Message 2
...

In Jquery code, I get the value of the selected option:

 $("#optionId').val()

And with Struts bean:message tag:

alert("<bean:message 
bundle='Message'`key='msg."+$("#clientTypeId').val()"+'/>");

The alert message showed is always:

???en.msg.0x??? (x is 0 or 1 or ...)

Have any idea about my problem please?

Thanks!

  • 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-06-11T15:03:00+00:00Added an answer on June 11, 2026 at 3:03 pm

    You can’t use JSTL when executing Javascript. What I would do is use JSTL to generate a Javascript object, for example:

    <script type="text/javascript">
      var messages = {
      <c:forEach begin="0" end="20" var="n" varStatus="s">
        ${s.first ? '' : ', '}
        <c:set var="key" value="${n gt 9 ? '' : '0'}${n}"/>
        <fmt:message key="msg.${key}" var="msg"/>
        "<c:out value="${key}"/>": "<c:out value="${msg}"/>"
      </c:forEach>
      };
    </script>
    

    Now you can get a message from the Javascript object:

    alert(messages[$("#clientTypeId").val()]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to output this jsp in haml: <select> <option ${page.defaultCar==Volvo ? selected
we have a classic JSP + Servlets application and would like to show Content
I would like to extend a liferay core jsp by custom-jsp hook. In this
My jsp page <select name=se> <option value=1>D1</option> <option value=2>D2</option> <option value=3>D3</option> </select> While the
I have a jsf 1.2 application where I need to show a page (jsp)
From first.jsp I am sending some parameters to result.jsp as - <a href=result.jsp?itemId=${itemId}&itemName=${item.itemName}&itemCode=${item.itemCode}')>Show Items</a>
I'm trying to learn servlets and JSP and would like to do this with
I would like to have a single JSP page that will do the following:
I have a decent working web application (Java/Servlet/Jsp) that I would like to improve
I would to know why I don't get anything with this. I have 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.