HI I am trying to pass a value from dropdown list on onchange event fo the dropdown in a jsp page through AJAX to servlet. The servlet then returns the value back to the jsp page and displays it in dropdown list.

the problem I am facing is that the value returned is null. though in the servlet the value is set but when I pass the value to jsp, the value is null. somewhere I am passing the value properly. could someone please help. It's important. thnaks in advance.

here is the code for that:

inputPage.jsp

<html>

<head>
</head>
<body>
<%@page language="java" import="java.util.*,java.sql.*,java.util.ArrayList,java.io.*" contentType="text/html" %> 


    <script type="text/javascript">
    function showValues(str)
    {
    alert("str"+str);
    if (str=="")
      {
      document.getElementById("col3").innerHTML="";
      return;
      }  
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        alert("xmlhttp.status"+xmlhttp.status);

        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;




        }
      }
      alert("str1"+str);
    xmlhttp.open("GET","/Tester.html?q="+str,true);
    xmlhttp.send();
    }
    </script>



<form name="myform" method="GET">
<div align="left">

<table id="table1" border="1" cellpadding="0" cellspacing="0" width="70%">

<tr>


<th id="header2" width="33%" bgcolor="#969696"><b>TAG NAMES</b></th>
<th id="header3" width="33%" bgcolor="#969696"><b>VALUE</b></th>

</tr>


<tr>



<td id="col2" width="33%"><select name="tagName" onchange="showValues(this.value)">               
    <option id="row10" name="select" value="1">SELECT</option>
    <option id="row11" name="func_type" value="2">FUNCTION_TYPE</option>
    <option id="row12" name="comm" value="3">COMMAND</option>
    <option id="row13" name="pay_type" value="4">PAYMENT_TYPE</option>

    </select>
</td>

<td>


    <select name="txtHint"> 
        <%String name=(String)request.getParameter("q");%>
        <option ><%=name%></option>; 
        <option >0</option>;
    </select>

<td>

</tr>


</table>

</div>

<br> <INPUT TYPE=submit name=submit Value="Submit">


</form>
</body>
</html>

DataServlet.java

JSP Syntax (Toggle Plain Text)
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
    System.out.println("in servlet#########################: doGet() method");
    PrintWriter out = response.getWriter();

    tagName = request.getParameter("q");
    System.out.println("tagName"+tagName);
    if(tagName.equals("2")){
        System.out.println("tagValue"+tagValue);
        tagValue = getInitParameter("2");   
        System.out.println("tagValue"+tagValue);
        request.setAttribute("q",tagValue);
        System.out.println("attribute value "+request.getAttribute("q"));
        RequestDispatcher dispatcher = 
            request.getRequestDispatcher("/inputPage.jsp");

        if (dispatcher != null) dispatcher.forward(request, response);

    }

    String tagName = "";
    String tagValue ="";


}

web.xml

<servlet>   

    <servlet-name>    
        DataServlet    
    </servlet-name>    

    <servlet-class>    
        tester.DataServlet    
    </servlet-class> 

    <init-param>  
        <param-name> debug</param-name>  
        <param-value>true</param-value>  
        <!--  <description>Set to 'true' for debug output.</description>  -->
    </init-param> 

    <init-param> 
        <param-name>2</param-name>    
        <param-value>PAYMENT</param-value>    
    </init-param> 

    <init-param>    
        <param-name>3</param-name>    
        <param-value>SALE</param-value> 
        <!--<param-value>DEBIT</param-value> -->

    </init-param>   

    <init-param>    
        <param-name>4</param-name>    
        <param-value>CREDIT</param-value>  
    <!-- <param-value>VOID</param-value>-->

    </init-param> 


 </servlet>  



 <servlet-mapping>    

    <servlet-name>    
        DataServlet    
    </servlet-name>    

    <url-pattern>    
        /RitaTester.html 
    </url-pattern>   

 </servlet-mapping>

What you are doing in the servlet is that you are setting the 'tagValue' as an attribute in the request and than forwarding the request.
But for AJAX requests all you have to do is just send the 'tagValue' on the response output stream

You should do something like this in your servlet,

.......
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
System.out.println("in servlet#########################: doGet() method");
PrintWriter out = response.getWriter();

tagName = request.getParameter("q");

if(tagName.equals("2")){
     tagValue = getInitParameter("2"); 
     out.println(tagValue); //This will send the data as a response text to AJAX request
}

String tagName = "";
String tagValue ="";

...............
}

You can also create a XML as a String object and send it on the response output stream and in the javascript callback function you can read it with xmlhttp.responseXML

A nice introductory tutorial can be found at
http://www.oracle.com/technetwork/articles/javaee/ajax-135201.html

Hope this helps

Hi Thanks for replying back...I am new to this forum and was not sure if anyone's going to reply back.So I saw a post on this forum and actly changed my code according to that...but still I am facing the problem. The value of 'tagValue' is not getting displayed on the page. I have included your change too. Could you please take a look at the new code and suggest me whats wrong.
If I do a sysout on jsp page to see the value of 'userBean.getTagValues()', I am getting the expected values. but hte values are not just not getting displayed on the page. Is it the problem of the dropdown list..please advice.
I am new to JSP , servlets and AJAX. I would really appreciate if you could go throught the new code and give some advice. Thanks in advance.

-------inputPage.jsp------------

<%@ page import="java.util.*"%>
<%@ page import="bean.UserBean"%>

<jsp:useBean id="userBean" class="bean.UserBean" scope="session" />


<html>

<head><title>Tester</title>
</head>
<body>



<script type="text/javascript">
function showValues(str)
{
alert("str"+str);
if (str=="")
  {
  document.getElementById("col3").innerHTML="";
  return;
  }  
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    alert("xmlhttp.status"+xmlhttp.status);

    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;




    }
  }
  alert("str1"+str);
xmlhttp.open("GET","/RitaTester.html?q="+str,true);
xmlhttp.send();
}
</script>



<form name="myform" method="GET">
<div align="left">

<table id="table1" border="1" cellpadding="0" cellspacing="0" width="70%">

<tr>


<th id="header2" width="33%" bgcolor="#969696"><b>RITA TAGS NAME</b></th>
<th id="header3" width="33%" bgcolor="#969696"><b>VALUE</b></th>

</tr>


<tr>



<td id="col2" width="33%">
     <select name="tagName" onchange="showValues(this.value)">               
    <option id="row10" name="select" value="1">SELECT</option>
    <option id="row11" name="func_type" value="2">FUNCTION_TYPE</option>
    <option id="row12" name="comm" value="3">COMMAND</option>
    <option id="row13" name="pay_type" value="4">PAYMENT_TYPE</option>
    <option id="row14" name="pay_type" value="5">TRANS_AMOUNT</option>
    <option id="row15" name="pay_type" value="6">ACCT_NUM</option>
    <option id="row16" name="pay_type" value="7">EXP_YEAR</option>
    <option id="row17" name="pay_type" value="8">EXP_MONTH</option>
    <option id="row18" name="pay_type" value="9">CUSTOMER_ZIP</option>
    <option id="row19" name="pay_type" value="10">CUSTOMER_STREET</option>
    <option id="row20" name="pay_type" value="11">CLIENT_ID</option>
    <option id="row21" name="pay_type" value="12">USER_ID</option>
    <option id="row22" name="pay_type" value="13">USER_PW</option>
    <option id="row23" name="pay_type" value="14">TRACK_DATA</option>
    <option id="row24" name="pay_type" value="15">AUTH_CODE</option>
    <option id="row25" name="pay_type" value="16">TROUTD</option>
    <option id="row26" name="pay_type" value="17">TPP_ID</option>
    <option id="row27" name="pay_type" value="18">PURCHASE_ID</option>
    <option id="row28" name="pay_type" value="19">TAX_AMOUNT</option>
    </select>
</td>
</tr>



</table>


<table>

    <tr style="background-color:#f0a64e;">
        <th class="border">Values</th>

    </tr>
   <%if(userBean.getTagValues()!=null){
       for(int i=0; i < userBean.getTagValues().size(); i++) {
            UserBean user = new UserBean();     
            user.setTagValue(userBean.getTagValues().get(i));


        %>
        <tr>
            <td><%= user.getTagValue() %></td>

        </tr>
        <%}%>
   <%}%>
</table>



</div>



</form>
</body>
</html>

-----------web.xml--------

<servlet>   

    <servlet-name>    
        DataServlet    
    </servlet-name>    

    <servlet-class>    
        tester.DataServlet    
    </servlet-class> 

    <init-param>  
        <param-name> debug</param-name>  
        <param-value>true</param-value>  
        <!--  <description>Set to 'true' for debug output.</description>  -->
    </init-param>            

    <init-param>         
        <param-name>2</param-name>            
        <param-value>FUNCTION_TYPE</param-value>      
    </init-param>        

    <init-param>         
        <param-name>3</param-name>            
        <param-value>COMMAND</param-value>        
    </init-param>

    <init-param>         
        <param-name>4</param-name>            
        <param-value>PAYMENT_TYPE</param-value>       
    </init-param>

 </servlet>

<servlet-mapping>    

    <servlet-name>    
        DataServlet    
    </servlet-name>    

    <url-pattern>    
        /RitaTester.html 
    </url-pattern>   

 </servlet-mapping>

-----DataServlet.java-----------

package tester;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import model.DataManager;
import bean.UserBean;

public class DataServlet extends HttpServlet {

    String selected = "";
    String tagName ="";
    boolean debug;  
    UserBean userBean = null;  
    DataManager dataManager = null;
    public void init() throws ServletException {  
        String debugParam = getInitParameter("debug");  
        if (debugParam != null &&  
            debugParam.equalsIgnoreCase("true")) {  
          debug = true;  
        } else {  
          debug = false;  
        }  


      }   

    public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
    System.out.println("in servlet#########################: doGet() method");
    PrintWriter out = response.getWriter();
    userBean = new UserBean();      
    dataManager = new DataManager();

    selected = request.getParameter("q");
    System.out.println("selected"+selected);


    tagName = getInitParameter(selected);
    System.out.println("tagName"+tagName);

    userBean = dataManager.getUserData(tagName);

    HttpSession session = request.getSession(true);

    if(userBean!=null){
        System.out.println("tagValues"+userBean.getTagValues());
        out.println(userBean);          

    RequestDispatcher dispatcher = request.getRequestDispatcher("/inputPage.jsp");  
        if (dispatcher != null){
                  dispatcher.forward(request, response);
             }
    }

     }

    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
        doGet(request,response);

    }
}

--------DataManager.java--------

package model;



import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


import java.util.*;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import bean.UserBean;

public class DataManager{

    String dbURL = "URL";
    String dbDriver = "DRIVERNAME"; 

    String tagID = "";



    /*     * Open database connection     */    
    public Connection getConnection(){      
        Connection conn = null;     
        try {   
             System.out.println(dbDriver);   
            System.out.println(dbURL);       
            Class.forName(dbDriver);
            conn = DriverManager.getConnection(dbURL);        
        }catch (ClassNotFoundException e) {       
            System.out.println("Could not connect to DB");        
            e.printStackTrace();          
        }catch (SQLException e) {         
            System.out.println("Could not connect to DB");        
            e.printStackTrace();          
        }       

        return conn;   
    }    

    /*     * Close open database connection     */    

    public void putConnection(Connection conn){     
        if (conn != null){          
             try{               
            conn.close();       
             }catch (SQLException e) {          
            System.out.println("Enable to close DB connection");                      e.printStackTrace(); 
             }      
        }    
    }

    public UserBean getUserData(String tagName){        
        UserBean userBean = new UserBean();
        ArrayList<String> valueList = new ArrayList<String>();
        Connection conn = getConnection();      
        System.out.println("conn"+conn);
        if (conn != null){      
            ResultSet rs = null;        
            Statement stmt = null;  

            try{    
                String query =  " SELECT * FROM TABLENAME" +
                      " WHERE TAG_NAME =    '" 
                      +tagName +
                       "'" ;        

                stmt = conn.createStatement();      
                rs = stmt.executeQuery(query);          
                while(rs.next()){           
                    tagID = rs.getString("TAG_NAME_ID");
                }   

                rs = null;

             try{
                String valueQuery = " SELECT TAG_VALUE FROM TABLENAME2" +
                    " WHERE TAG_NAME_ID =   " +tagID ;

                rs = stmt.executeQuery(valueQuery);

                while(rs.next()){
                valueList.add(rs.getString(1));
                userBean.setTagValues(valueList);

            }
           }catch(SQLException sqle5){
            System.err.println(sqle5);
           }

           }catch(SQLException ex)  {               
            System.out.println("SQLException:" + ex.getMessage());                                  
           }finally{        
            if (stmt != null){              
                try { 
                    stmt.close(); 
                }catch (SQLException e) { 
                    e.printStackTrace();
                }       
            }           

            putConnection(conn);                   
        } 
         }

        return userBean;
    }
}

-------------UserBean.java--------

package bean;


import java.util.*;



public class UserBean {

    public String tagName;

    public String tagValue;

    public ArrayList<String> tagValues;

    public UserBean(){

    }

    public String getTagName() {
        return tagName;
    }

    public void setTagName(String tagName) {
        this.tagName = tagName;
    }

    public String getTagValue() {
        return tagValue;
    }

    public void setTagValue(String tagValue) {
        this.tagValue = tagValue;
    }

    public ArrayList<String> getTagValues() {
        return tagValues;
    }

    public void setTagValues(ArrayList<String> tagValues) {
        this.tagValues = tagValues;
    }


}

The code is working now. The change you suggested in addition to few other changes worked. Thanks a ton.. :). Will be posting the working code soon.

The code is working now. The change you suggested in addition to few other changes worked. Thanks a ton.. :). Will be posting the working code soon.

And please use code tags. I have found very difficult to follow your code without an editor here

This program helps in creating a jsp page in which 2nd dropdown is populated based on the selected value of the first dropdown using AJAX. The values of the second dropdown are fetched from the database by calling a servlet.then the selected values are submitted and the result is printed on the same jsp page. however on fetching the result, the inputPage.jsp is submitted again due to which the selected values of the dropdown are not prepopulated. in order to avoid that currently I am displaying the results on submission on another jsp page called transInput.jsp. In case anybody can help me on that, it would be great. thanks

-------inputPage.jsp------------

<%@ page import="java.util.*"%>


<html>

<head><title>Tester</title>
</head>
<body>



<script type="text/javascript">
	function showValues(str,divId)
	{
		
		if (str==""){
		  	document.getElementById("col3").innerHTML="";
		  	return;
		}  
		try{
		// Firefox, Opera 8.0+, Safari
			xmlhttp=new XMLHttpRequest();
		}catch (e)	{
		// Internet Explorer
			try{
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			}catch (e)	{
				try{
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}catch (e)	{
					alert("Your browser does not support AJAX!");
				}
			}
		}
		
		xmlhttp.onreadystatechange=function(){
		  
			if (xmlhttp.readyState==4 && xmlhttp.status==200){
		    	
		    	var response = xmlhttp.responseText;

      			if(response) {
         			// UPDATE ajaxTest content
         			document.getElementById(divId).innerHTML = response;
      			}
		   		
			}
		}
		  
		
		xmlhttp.open("get","/RitaTester.html?q="+str,true);
		xmlhttp.send();
	}
	
</script>



<form name="myform" method="post" action="/RitaTester.html">


<table id="table1" border="1" cellpadding="0" cellspacing="0" >

	<tr>


		<th id="header2" bgcolor="#5E8FBD"><font face="Verdana, Arial" size="2" color="#FFFFFF"><b>RITA TAGS NAME</b></font></th>
		<th id="header3" bgcolor="#5E8FBD"><font face="Verdana, Arial" size="2" color="#FFFFFF"><b>VALUE</b></font></th>

	</tr>


	<tr>



		<td id="col1" >
			<select name="tagName0" onchange="showValues(this.value,'txtHint')">				
					<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint">
  			<select name="cmbValues">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col2" >
			<select name="tagName1" onchange="showValues(this.value,'txtHint1')">				
					<option id="row10" value="SELECT">--SELECT TAG--</option>
					<option id="row11" value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12" value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint1">
  			<select name="cmbValues1">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col3" >
			<select name="tagName2" onchange="showValues(this.value,'txtHint2')">				
					<option id="row10" value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint2">
  			<select name="cmbValues2">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col4" >
			<select name="tagName3" onchange="showValues(this.value,'txtHint3')">				
					<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint3">
  			<select name="cmbValues3">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col5" >
			<select name="tagName4" onchange="showValues(this.value,'txtHint4')">				
					<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint4">
  			<select name="cmbValues4">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col6" >
			<select name="tagName5" onchange="showValues(this.value,'txtHint5')">				
					<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint5">
  			<select name="cmbValues5">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col7" >
			<select name="tagName6" onchange="showValues(this.value,'txtHint6')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint6">
  			<select name="cmbValues6">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col8" >
			<select name="tagName7" onchange="showValues(this.value,'txtHint7')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint7">
  			<select name="cmbValues7">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col9" >
			<select name="tagName8" onchange="showValues(this.value,'txtHint8')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint8">
  			<select name="cmbValues8">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col10" >
			<select name="tagName9" onchange="showValues(this.value,'txtHint9')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint9">
  			<select name="cmbValues9">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col11" >
			<select name="tagName10" onchange="showValues(this.value,'txtHint10')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint10">
  			<select name="cmbValues10">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col12" >
			<select name="tagName11" onchange="showValues(this.value,'txtHint11')">				
					<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint11">
  			<select name="cmbValues11">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col13" >
			<select name="tagName12" onchange="showValues(this.value,'txtHint12')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint12">
  			<select name="cmbValues12">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col14" >
			<select name="tagName13" onchange="showValues(this.value,'txtHint13')">				
					<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint13">
  			<select name="cmbValues13">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col15" >
			<select name="tagName14" onchange="showValues(this.value,'txtHint14')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint14">
  			<select name="cmbValues14">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col16" >
			<select name="tagName15" onchange="showValues(this.value,'txtHint15')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint15">
  			<select name="cmbValues15">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
	<tr>



		<td id="col17" >
			<select name="tagName16" onchange="showValues(this.value,'txtHint16')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint16">
  			<select name="cmbValues16">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	<tr>



		<td id="col18" >
			<select name="tagName17" onchange="showValues(this.value,'txtHint17')">				
				<option id="row10"  value="SELECT">--SELECT TAG--</option>
					<option id="row11"  value="FUNCTION_TYPE">FUNCTION_TYPE</option>
					<option id="row12"  value="COMMAND">COMMAND</option>
					<option id="row13"  value="PAYMENT_TYPE">PAYMENT_TYPE</option>
					<option id="row14"  value="TRANS_AMOUNT">TRANS_AMOUNT</option>
					<option id="row15"  value="ACCT_NUM">ACCT_NUM</option>
					<option id="row16"  value="EXP_YEAR">EXP_YEAR</option>
					<option id="row17"  value="EXP_MONTH">EXP_MONTH</option>
					<option id="row18"  value="CUSTOMER_ZIP">CUSTOMER_ZIP</option>
					<option id="row19"  value="CUSTOMER_STREET">CUSTOMER_STREET</option>
					<option id="row20"  value="CLIENT_ID">CLIENT_ID</option>
					<option id="row21"  value="USER_ID">USER_ID</option>
					<option id="row22"  value="USER_PW">USER_PW</option>
					<option id="row23"  value="TRACK_DATA">TRACK_DATA</option>
					<option id="row24"  value="AUTH_CODE">AUTH_CODE</option>
					<option id="row25"  value="TROUTD">TROUTD</option>
					<option id="row26"  value="TPP_ID">TPP_ID</option>
					<option id="row27"  value="PURCHASE_ID">PURCHASE_ID</option>
					<option id="row28"  value="TAX_AMOUNT">TAX_AMOUNT</option>
			</select>
		</td>



		<td id="txtHint17">
  			<select name="cmbValues17">
				<option value="">--SELECT TAG VALUE--</option>
			</select>
		</td>
		
	</tr>
	
	
</table>

<p></p>
<input type="submit" name="submit" value="Process Transaction"></input>


</form>
</body>
</html>

------DataServlet.java----------

package tester;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.UnknownHostException;
import java.util.Hashtable;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import model.DataManager;
import model.SocketManager;
import bean.UserBean;

import com.gosoftware.rita.RiTA;


public class DataServlet extends HttpServlet {
	
	String selected = "";
	//String tagName ="";
	boolean debug;  
	UserBean userBean = null;  
	DataManager dataManager = null;
	int j=0;
	String port = "5012";
	String host= "127.0.0.1";
	int timeOut = 600000;
	SocketManager socket = new SocketManager();
	RiTA myRita = null;
	Hashtable htIn = new Hashtable();
	
	
	public void init() throws ServletException {  
	    String debugParam = getInitParameter("debug");  
	    if (debugParam != null &&  
	        debugParam.equalsIgnoreCase("true")) {  
	      debug = true;  
	    } else {  
	      debug = false;  
	    }  
	    
	  
	  }   
	
	public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
		System.out.println("in servlet#########################: doGet() method");
		PrintWriter out = response.getWriter();
		userBean = new UserBean();		
		dataManager = new DataManager();
		String tagValue="";
		selected = request.getParameter("q"); //got the value selected from the dropdown list.
		System.out.println("selected"+selected);
		
		if(selected.equals("SELECT")){
			tagValue = "<select name='cmbValues'>";
			tagValue += "<option>--SELECT TAG VALUE--</option>";
			tagValue +="</select>";
			out.println(tagValue);
		}else if(selected.equals("FUNCTION_TYPE") || selected.equals("COMMAND") || selected.equals("PAYMENT_TYPE")){
		
			/*tagName = getInitParameter(selected);
			System.out.println("tagName"+tagName);*/
			
			userBean = dataManager.getUserData(selected);//getting the corresponding value(s) for second dropdown say States in a class object.
			
			
			
			if(userBean!=null){
				System.out.println("tagValues"+userBean.getTagValues());
				
				tagValue = "<select name='cmbValues"+j+"'>";
				j++;
				for(int i =0; i<userBean.getTagValues().size();i++){ //retrieving the values from the class object variable -'tagValues' 
					tagValue += "<option value=\""+userBean.getTagValues().get(i)+"\">"+userBean.getTagValues().get(i)+"</option>";
				}
				tagValue +="</select>";
				
				System.out.println("tagValue"+tagValue);
				
				out.println(tagValue); 	//sending the value back to AJAX		
					
				/*RequestDispatcher dispatcher = request.getRequestDispatcher("/inputPage.jsp");	
				 if (dispatcher != null){
					 dispatcher.forward(request, response);
				 }*/
			}
		}else{
			tagValue = "<input type='text' name='text"+j+"' size='40' value=''>";
			j++;
			System.out.println("tagValue for input textbox"+tagValue);
			out.println(tagValue);
		}
		
	}
 
	public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {

		PrintWriter out = response.getWriter();
		HttpSession session = request.getSession(true);
		try{
			System.out.println("in doGet() method of ResponseServlet#################");
			socket.openSocket(host, port, timeOut);
			System.out.println("socket"+socket);	     
		}catch(UnknownHostException e){
			System.out.println("Could not establish a socket connection");	      
			e.printStackTrace();
		}catch(IOException e){
			System.out.println("Could not establish a socket connection");	      
			e.printStackTrace();
		}catch(Exception e){
			System.out.println("Could not establish a socket connection");	      
			e.printStackTrace();
		}
		/*try{
			try{
				System.out.println("Creating Rita instance...");
				myRita = new RiTA("rita");
			}catch (Exception e){
		               
			   //If RiTA is already active in other thread try default constructor.
			   myRita = new RiTA();	
			}
		}catch (RiTAException jce){
	        if(null == myRita){
	          System.out.println("Couldnot create a RITA instance.");
	        }
	    }
	    
		
		
		
		
		if(!request.getParameter("tagName0").equals("SELECT")){
			System.out.println("in if");
			String value1= request.getParameter("tagName0");
			if(request.getParameter("cmbValues0")!=null){
				String value2 = request.getParameter("cmbValues0");
				htIn.put(value1, value2);
			}else if(request.getParameter("text0")!=null){
				String value2 =  request.getParameter("text0");
				htIn.put(value1, value2);
			}
		}
		
		myRita.setInputProperties(htIn);
		myRita.execute(true);
		
		Hashtable htOut = myRita.getOutputProperties();
		
		Enumeration e = htOut.keys();    
		
		while(e.hasMoreElements()){    
		
			System.out.println("Elements"+e.nextElement());
		}*/
		
		String msg="";
		if(!request.getParameter("tagName0").equals("SELECT")){
			msg += request.getParameter("tagName0") + " ";
			if(request.getParameter("cmbValues0")!=null){
				msg += request.getParameter("cmbValues0") + "\r\n";
			}else if(request.getParameter("text0")!=null){
				msg += request.getParameter("text0") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName1").equals("SELECT")){
			msg += request.getParameter("tagName1") + " ";
			if(request.getParameter("cmbValues1")!=null){
				msg += request.getParameter("cmbValues1") + "\r\n";
			}else if(request.getParameter("text1")!=null){
				msg += request.getParameter("text1") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName2").equals("SELECT")){
			msg += request.getParameter("tagName2") + " ";
			if(request.getParameter("cmbValues2")!=null){
				msg += request.getParameter("cmbValues2") + "\r\n";
			}else if(request.getParameter("text2")!=null){
				msg += request.getParameter("text2") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName3").equals("SELECT")){
			msg += request.getParameter("tagName3") + " ";
			if(request.getParameter("cmbValues3")!=null){
				msg += request.getParameter("cmbValues3") + "\r\n";
			}else if(request.getParameter("text3")!=null){
				msg += request.getParameter("text3") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName4").equals("SELECT")){
			msg += request.getParameter("tagName4") + " ";
			if(request.getParameter("cmbValues4")!=null){
				msg += request.getParameter("cmbValues4") + "\r\n";
			}else if(request.getParameter("text4")!=null){
				msg += request.getParameter("text4") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName5").equals("SELECT")){
			msg += request.getParameter("tagName5") + " ";
			if(request.getParameter("cmbValues5")!=null){
				msg += request.getParameter("cmbValues5") + "\r\n";
			}else if(request.getParameter("text5")!=null){
				msg += request.getParameter("text5") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName6").equals("SELECT")){
			msg += request.getParameter("tagName6") + " ";
			if(request.getParameter("cmbValues6")!=null){
				msg += request.getParameter("cmbValues6") + "\r\n";
			}else if(request.getParameter("text6")!=null){
				msg += request.getParameter("text6") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName7").equals("SELECT")){
			msg += request.getParameter("tagName7") + " ";
			if(request.getParameter("cmbValues7")!=null){
				msg += request.getParameter("cmbValues7") + "\r\n";
			}else if(request.getParameter("text7")!=null){
				msg += request.getParameter("text7") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName8").equals("SELECT")){
			msg += request.getParameter("tagName8") + " ";
			if(request.getParameter("cmbValues8")!=null){
				msg += request.getParameter("cmbValues8") + "\r\n";
			}else if(request.getParameter("text8")!=null){
				msg += request.getParameter("text8") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName9").equals("SELECT")){
			msg += request.getParameter("tagName9") + " ";
			if(request.getParameter("cmbValues9")!=null){
				msg += request.getParameter("cmbValues9") + "\r\n";
			}else if(request.getParameter("text9")!=null){
				msg += request.getParameter("text9") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName10").equals("SELECT")){
			msg += request.getParameter("tagName10") + " ";
			if(request.getParameter("cmbValues10")!=null){
				msg += request.getParameter("cmbValues10") + "\r\n";
			}else if(request.getParameter("text10")!=null){
				msg += request.getParameter("text10") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName11").equals("SELECT")){
			msg += request.getParameter("tagName11") + " ";
			if(request.getParameter("cmbValues11")!=null){
				msg += request.getParameter("cmbValues11") + "\r\n";
			}else if(request.getParameter("text11")!=null){
				msg += request.getParameter("text11") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName12").equals("SELECT")){
			msg += request.getParameter("tagName12") + " ";
			if(request.getParameter("cmbValues12")!=null){
				msg += request.getParameter("cmbValues12") + "\r\n";
			}else if(request.getParameter("text12")!=null){
				msg += request.getParameter("text12") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName13").equals("SELECT")){
			msg += request.getParameter("tagName13") + " ";
			if(request.getParameter("cmbValues13")!=null){
				msg += request.getParameter("cmbValues13") + "\r\n";
			}else if(request.getParameter("text13")!=null){
				msg += request.getParameter("text13") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName14").equals("SELECT")){
			msg += request.getParameter("tagName14") + " ";
			if(request.getParameter("cmbValues14")!=null){
				msg += request.getParameter("cmbValues14") + "\r\n";
			}else if(request.getParameter("text14")!=null){
				msg += request.getParameter("text14") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName15").equals("SELECT")){
			msg += request.getParameter("tagName15") + " ";
			if(request.getParameter("cmbValues15")!=null){
				msg += request.getParameter("cmbValues15") + "\r\n";
			}else if(request.getParameter("text15")!=null){
				msg += request.getParameter("text15") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName16").equals("SELECT")){
			msg += request.getParameter("tagName16") + " ";
			if(request.getParameter("cmbValues16")!=null){
				msg += request.getParameter("cmbValues16") + "\r\n";
			}else if(request.getParameter("text16")!=null){
				msg += request.getParameter("text16") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		if(!request.getParameter("tagName17").equals("SELECT")){
			msg += request.getParameter("tagName17") + " ";
			if(request.getParameter("cmbValues17")!=null){
				msg += request.getParameter("cmbValues17") + "\r\n";
			}else if(request.getParameter("text17")!=null){
				msg += request.getParameter("text17") + "\r\n";
			}else{
				msg += " " + "\r\n";
			}
		}
		
		msg += "." + "\r\n" ;
		
	
		
		System.out.println("msg:"+msg);	    
		if(msg!=null){
			socket.getOutWriter().println(msg);
			
			String totalResponse = "";
			String responseText = "";
			
			// keep on reading from/to the socket till we receive the period '.'
			// once we received that then break.		
			
			while(!(totalResponse = socket.getInReader().readLine()).equals(null)) {
				
				responseText += totalResponse+ "\r\n";
									            								
				try{
					if(0==totalResponse.indexOf(".")){
						if(false == socket.getInReader().ready()){
							
							break;	
						}
										
					}
				}catch(IndexOutOfBoundsException io){
					System.err.println("IOException:  " + io);
				}
				
				
				
			}
			
			//userBean.setResponseText(responseText);
			System.out.println("ResponseText:"+responseText);
			//session.setAttribute( "userBean", userBean);
			request.setAttribute("responseText", responseText);
			request.setAttribute("msg", msg);
			RequestDispatcher dispatcher = request.getRequestDispatcher("/transInput.jsp");	
			 if (dispatcher != null){
				 dispatcher.forward(request, response);
			 }
				
			// clean up:
			// close the output stream
			// close the input stream
			totalResponse = "";
			msg="";
			    
			
			socket.getOutWriter().close();
			socket.getInReader().close();
			j=0;
	
		}	
		
	
		
	}
}
--------DataManager.java--------

package model;



import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


import java.util.*;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import bean.UserBean;

public class DataManager{

String dbURL = "URL";
String dbDriver = "DRIVERNAME"; 

String tagID = "";



/* * Open database connection */ 
public Connection getConnection(){ 
Connection conn = null; 
try { 
System.out.println(dbDriver); 
System.out.println(dbURL); 
Class.forName(dbDriver);
conn = DriverManager.getConnection(dbURL); 
}catch (ClassNotFoundException e) { 
System.out.println("Could not connect to DB"); 
e.printStackTrace(); 
}catch (SQLException e) { 
System.out.println("Could not connect to DB"); 
e.printStackTrace(); 
} 

return conn; 
} 

/* * Close open database connection */ 

public void putConnection(Connection conn){ 
if (conn != null){ 
try{ 
conn.close(); 
}catch (SQLException e) { 
System.out.println("Enable to close DB connection"); e.printStackTrace(); 
} 
} 
}

public UserBean getUserData(String tagName){ 
UserBean userBean = new UserBean();
ArrayList<String> valueList = new ArrayList<String>();
Connection conn = getConnection(); 
System.out.println("conn"+conn);
if (conn != null){ 
ResultSet rs = null; 
Statement stmt = null; 

try{ 
String query = " SELECT * FROM TABLENAME" +
" WHERE TAG_NAME = '" 
+tagName +
"'" ; 

stmt = conn.createStatement(); 
rs = stmt.executeQuery(query); 
while(rs.next()){ 
tagID = rs.getString("TAG_NAME_ID");
} 

rs = null;

try{
String valueQuery = " SELECT TAG_VALUE FROM TABLENAME2" +
" WHERE TAG_NAME_ID = " +tagID ;

rs = stmt.executeQuery(valueQuery);

while(rs.next()){
valueList.add(rs.getString(1));
userBean.setTagValues(valueList);

}
}catch(SQLException sqle5){
System.err.println(sqle5);
}

}catch(SQLException ex) { 
System.out.println("SQLException:" + ex.getMessage()); 
}finally{ 
if (stmt != null){ 
try { 
stmt.close(); 
}catch (SQLException e) { 
e.printStackTrace();
} 
} 

putConnection(conn); 
} 
}

return userBean;
}
}

-------------UserBean.java--------

package bean;


import java.util.*;



public class UserBean {

public String tagName;

public String tagValue;

public ArrayList<String> tagValues;

public UserBean(){

}

public String getTagName() {
return tagName;
}

public void setTagName(String tagName) {
this.tagName = tagName;
}

public String getTagValue() {
return tagValue;
}

public void setTagValue(String tagValue) {
this.tagValue = tagValue;
}

public ArrayList<String> getTagValues() {
return tagValues;
}

public void setTagValues(ArrayList<String> tagValues) {
this.tagValues = tagValues;
}


}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.