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

  • Home
  • SEARCH
  • 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 3753956
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:28:17+00:00 2026-05-19T09:28:17+00:00

I’ve created a jsp page. In that when i select 1 check-box or both

  • 0

I’ve created a jsp page. In that when i select 1 check-box or both check-box or none, the corresponding text-boxes and list-box must be displayed in the same page.

For that i tried of calling a javascipt function when i click the checkbox. The javascript function contain code to display the textboxes. But it didn’t work.

Since I’m doing this project in struts, I don’t know how to get check-box value. And calling of JavaScript function works. But didn’t enter into jsp code in JavaScript function.

My code is

 <tr>
 <td>SEJ:</td>
 <td>SEJ 1:<html:checkbox property="sej1" value="on" onclick="checkbox_trial()"></html:checkbox></td>
 <td>SEJ 2:<html:checkbox property="sej2" value="on" onclick="checkbox_trial()"></html:checkbox></td>
 </tr>


  <script type="text/javascript">
  function checkbox_trial()
  {

        <% if(request.getParameter("sej1")=="on"){
    %> 
   <tr><td>SEJ1 Age<html:text property="sej1_age"></html:text></td></tr>
   <tr><td>SEJ1 DOI<html:text property="sej1_doi"></html:text></td></tr>
   <%} 

       else if(request.getParameter("sej2")=="on"){%>
   <tr><td>SEJ2 Age<html:text property="sej2_age"></html:text></td></tr>
       <tr><td>SEJ2 DOI<html:text property="sej2_doi"></html:text></td></tr>
   <%}

       else if((request.getParameter("sej1")=="on")&&(request.getParameter("sej2")=="on")){%>
   <tr><td>SEJ1 Age<html:text property="sej1_age"></html:text></td></tr>
   <tr><td>SEJ1 DOI<html:text property="sej1_doi"></html:text></td></tr>
   <tr><td>SEJ2 Age<html:text property="sej2_age"></html:text></td></tr>
   <tr><td>SEJ2 DOI<html:text property="sej2_doi"></html:text></td></tr>
   <%}

       else{%>
   NOTHING <% } %>
  }

  • 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-19T09:28:18+00:00Added an answer on May 19, 2026 at 9:28 am

    This is how it works: Java/JSP runs at webserver, produces HTML/CSS/JS, webserver sends it to webbrowser, webbrowser runs HTML/CSS/JS. Not Java/JSP. Rightclick the page in webbrowser and choose View Source. If Java/JSP has done its job right, you shouldn’t see any line of it in there.

    If you want to invoke Java/JSP code using JavaScript, you’ve got to invoke another HTTP request to the webserver so that it can execute the Java/JSP code based on the specific request. You can do that by either submitting the form or firing an asynchronous (ajaxical) request.

    Given the skills shown as far and the fact that you’re using Struts, I think ajax is going to be a bit too complex. I’d suggest to just submit the form on click of the checkbox

    <input type="checkbox" name="show" value="true" onclick="submit()" />
    

    and then let JSP conditionally display the input fields (just a JSTL example since I don’t do Struts)

    <c:if test="${param.show == 'true'}">
        <input type="text" />
        <select />
    </c:if>
    

    Update: you’ve by the way another major problem in the code. You can’t compare string values by == in Java code (you can do so in EL only). In Java code you need to use equals() method. Otherwise they will be compared by reference instead of by value. I’d suggest to learn basic Java as well.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm making a simple page using Google Maps API 3. My first. One marker
In order to apply a triggered animation to all ToolTip s in my app,
I am trying to understand how to use SyndicationItem to display feed which is
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.