Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

JSP and Javascript problem

Posted on 2002-05-15
1
Medium Priority
?
203 Views
Last Modified: 2010-04-01
I have a JSP page with a table of n rows.  Each row has the option of having
a dropdown list appear on that particular row.  The user should have the
ability to make a selection from the drop down list and have the page change
to the correct page automatically or it can allow the user to change and
have them click on a link that passes the value of the select box as a
parameter to the proper page.

The problem is that each row CAN NOT be in it's own form.  The action for
the current form is NOT the action I want the select box to use.

I can't seem to figure out how to get the value of the select box in
javascript passed as a parameter using a JSP variable.

Example code:
<form method="post" action="/index.jsp">
  <table>
   <tr>
    <td> Remove Row? </td>
    <td> View Options? </td>
    <td>  Name </td>
   </tr>
   <tr>
     <td> <input type=checkbox name='<%=rowNumber %>' value='<%=
someCheckboxValue %>'> </td>
     <td> <select name=selectOptions>
              <option value="option 1">option1</option>
              <option value="option 2">option2</option>
              <option value="option 3">option 3</option>
            </select>
             &nbsp; View Option &nbsp;
      </td>
      <td> <%= rowName %> </td>
    </tr>
   <tr>
     <td colspan="3"> <input type=button name='UpdateExampleForm'
value='Submit'> </td>
   </tr>
 </table>
</form>
0
Comment
Question by:sapientconceptions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
ahosang earned 400 total points
ID: 7012674
In <head>:
<script>
function goTo(val) {
  location.href="yourJspPage.jsp?parameter="+val;
}
</script>

In table:
<td> <select name="selectOptions" onchange="goTo(this.options[this.selectedIndex].value)">
             <option value="option 1">option1</option>
             <option value="option 2">option2</option>
             <option value="option 3">option 3</option>
           </select>
            &nbsp; View Option &nbsp;
     </td>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question