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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:21:53+00:00 2026-05-16T00:21:53+00:00

I have these three fields in my jsp page. <td> <html:text property=my_dto.number1 </html:text> </td>

  • 0

I have these three fields in my jsp page.

    <td>
           <html:text property="my_dto.number1" </html:text>
   </td>
    <td>
           <html:text property="my_dto.number2" </html:text> 
    </td>

    <td>                                    
          <input type ="checkbox" id ='isTrue' /> 
    </td>

now i want if isTrue is checked the two text box will be disabled. how to do it?

  • 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-16T00:21:54+00:00Added an answer on May 16, 2026 at 12:21 am

    Fact: JSP runs at webserver, produces HTML/CSS/JS and sends it to webbrowser. JS runs at webbrowser and sees only the HTML DOM tree, not any line of Java/JSP. Rightclick page in webbrowser, choose View Souce and see yourself. Do you understand this? OK, then continue.

    In the generated HTML source you should see some HTML <input type="text"> elements in place of Struts’ <html:text> components. I don’t do Struts, but a bit decent MVC framework will assign those HTML elements an id as well. If not done or when the ID value is randomly generated, you’d like to set a fixed ID yourself. According the TLD documentation, you need to set the styleId attribute: <html:text styleId="someFixedId">.

    Finally, write a JS function which get executed on click of the checkbox and modifies the disabled attribute of those text elements accordingly. Andy E has already given some hints. Here is how the JSP should basically look like:

    <html:text property="my_dto.number1" styleId="number1" />
    <html:text property="my_dto.number2" styleId="number2" /> 
    <input type="checkbox" id="isTrue" onclick="disableNumbers(this)" /> 
    
    <script>
        function disableNumbers(checkbox) {
            var number1 = document.getElementById("number1");
            var number2 = document.getElementById("number2");
            number1.disabled = number2.disabled = checkbox.checked;
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jsp page (says , MyJspPage.jsp ) - <html> <head> <meta http-equiv=Content-Type
i have some checkbox in my jsp page. there are some othe textfields in
I have jsp page (say, source.jsp ) with form: <html> <head> <body> <form action=Servlet123
I have a webpage where there are few text fields to be filled up
I have a standard HTML login page, which I would much rather use than
I have form and form text field which generates dynamically using JSP. And I'm
I have a JSP page where I load an arraylist which has the list
I have an HTML input field linked to a button with an onclick function
On my jsp page I have a loop that loops elements in a collection,
I have couple of JSP pages in my application with couple of input tags

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.