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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:15:58+00:00 2026-06-15T05:15:58+00:00

i have to get the button value on other page of jsp and execute

  • 0

i have to get the button value on other page of jsp and execute <div> tag based upon condition my index.jsp code is this

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>

<html>
<head>
<script type="text/javascript">
   function popuponclick()
   {
      my_window = window.open("file.jsp",
       "mywindow","status=1,width=350,height=150");

 }



</script>
    </head>
    <table>
    <tr>
    <td><button type="button" onclick="popuponclick()" value="1" name="name">GetAllEmployeeByID</button></td>
    </tr>
    <tr>
    <td><button type="button" onclick="popuponclick()" value="2" name="name">GetEmployeeByName</button></td>
    </tr>
     </table>
    </body>
    </html>

and my second.jsp is this

  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql"%>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml"%>
<%@page import="com.nousinfo.tutorial.employee.service.model.bo.EmployeeBO" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <script>
    function myfuntion(String name)
    { 
        location.
        document.getElementById("div1");
        }

</script>

</head>
<body>
    <form action="/EmployeeWeb/GetEmployee">
        <div id="div1" style="display: block;">
                <table>
                    <tr>
                        <td width="29">Find_Employee_By_Name:</td>
                        <td><input type="text" name="findbyname" /></td>


</tr>
                    <tr>
                        <td><input type="submit" name="submit" value="find"></td>
                    </tr>
                </table>
            </div>

 <div id="div2" style="display: none;">
                <table>
                    <tr>
                        <td width="29">Find_Employee_By_Name:</td>
                        <td><input type="text" name="findbyname" /></td>
                    </tr>
                    <tr>
                        <td><input type="submit" name="submit" value="find"></td>
                    </tr>
                </table>
            </div> 
    </form>
     <button onclick="myfunction()"></button>
</body>
</html>

how i will get the button value insecond jsp so that based upon condition i can run that <div> tag part

  • 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-15T05:15:58+00:00Added an answer on June 15, 2026 at 5:15 am

    Try this in the index.jsp page:

    function popuponclick()
    {
        var my_window = window.open("file.jsp", "mywindow","status=1,width=350,height=150");
    
        // Gets the two divs
        var div1 = my_window.document.getElementById('div1');
        var div2 = my_window.document.getElementById('div2');
    
        // Hides the two divs
        div1.style.display = 'none';
        div2.style.display = 'none';
    
        // Check what the value of the button pressed and displays the correct div
        if(this.value = '1')
            div1.style.display = 'block';
        else
            div2.style.display = 'block';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 buttons with same ID. I need to get each button's value
I have ASP.Net code generating my button's HTML for me using divs to get
I have a C# winforms application and I am trying to get a button
I have a button which needs to get created dynamically but the problem is
i have a label and button inside update panel, when i try to get
I have this input text and input button, I am trying to get them
hi i have property named. public bool ShowLabels{get; set;} and one toolbar menu button
I have a form and I wish to get the value of a radio
In my Facelets page I have a <div> and that contains some input text
I have an ASP .Net page with a radio button group and a text

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.