Sunday, February 6, 2011

Threading Producer and Consumer Example

package prodcongui;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GUI extends JFrame implements ActionListener
{
  private JButton start;
  private JPanel button_panel, prod_panel, con_panel;
  private JLabel prod=new JLabel("Producer is not producing.");
  private JLabel con=new JLabel("Consumer is not consuming.");
  private Container cp;
  private Thread producer=new Thread(new Runner(),"Producer");
  private Thread consumer=new Thread(new Runner2(),"Consumer");
  private int buffer[]={-1,-1,-1,-1};
  private int buffer_count=0, sum=0, read=0, write=0;
  public GUI()
  {
    super("Producer Consumer");
    cp=getContentPane();
    start=new JButton("Start Threads");
    button_panel=new JPanel();
    prod_panel=new JPanel();
    con_panel=new JPanel();
    button_panel.add(start);
    cp.add(button_panel,BorderLayout.SOUTH);
    prod_panel.add(prod);
    con_panel.add(con);
    cp.add(prod_panel,BorderLayout.NORTH);
    cp.add(con_panel,FlowLayout.CENTER);
    prod_panel.setBackground(Color.RED);
    con_panel.setBackground(Color.RED);
    start.addActionListener(this);
    setSize(330,200);
    setLocation(330,330);
    setResizable(false);
    setVisible(true);
  }
  public static void main(String[] args)
  {
    GUI app=new GUI();
    app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
  public synchronized void set(int value)
  {
    while(buffer_count==buffer.length)
    {
      try
      {
        SwingUtilities.invokeLater(new ChangeProdCon("Producer can't produce "+"\n"+
                                                  "Producer must wait.",prod,Color.ORANGE,prod_panel));
        wait();
      }
      catch(InterruptedException e){}
    }
    SwingUtilities.invokeLater(new ChangeProdCon("Producer produced "+value,prod,Color.GREEN,prod_panel));
    buffer[write]=value;
    write=(write+1)%buffer.length;
   // System.out.println(write);
    buffer_count++;
    notify();
  }
  public synchronized int get()
  {
    while(buffer_count==0)
    {
      try
      {
        SwingUtilities.invokeLater(new ChangeProdCon("Consumer can't consume "+"\n"+
                                                  "Consumer must wait.",con,Color.ORANGE,con_panel));
        wait();
      }
      catch(InterruptedException e){}
    }
    int readval=buffer[read];
    SwingUtilities.invokeLater(new ChangeProdCon("Consumer consumed "+readval,con,Color.GREEN,con_panel));
    read=(read+1)%buffer.length;
    buffer_count--;
    System.out.println(read);
    System.out.println(readval);
    notify();
    return readval;
  }
  private class ChangeProdCon implements Runnable
  {
    JLabel lbl;
    String s1;
    Color col;
    JPanel pnl;
    public ChangeProdCon(String s, JLabel l, Color c, JPanel p)
    {
      lbl=l;
      s1=s;
      col=c;
      pnl=p;
    }
    public void run()
    {
      lbl.setText(s1);
      pnl.setBackground(col);
    }
  }
  public void actionPerformed(ActionEvent e)
  {
    producer.start();
    consumer.start();
  }
  private class Runner implements Runnable
  {
    public void run()
    {
      for(int i=10; i<=500; i++)
      {
        try
        {
          Thread.sleep((int)(Math.random()*3001));
          set(i);
        }
        catch(InterruptedException e){}
      }
      SwingUtilities.invokeLater(new ChangeProdCon("Producer has finished producing.",prod,Color.RED,prod_panel));
    }
  }
  private class Runner2 implements Runnable
  {
              int i =0;
    public void run()
    {
      for( i=10; i<=500; i++)
      {
        try
        {
          Thread.sleep((int)(Math.random()*3001));
          sum=get();
        
          //sum+=get();
        }
        catch(InterruptedException e){}
        finally{
            //System.out.println(i);
        }
      }
      SwingUtilities.invokeLater(new ChangeProdCon("Consumer has finished consuming.",con,Color.RED,con_panel));
    }
  }
}

Database and Jsp



<%@ page import="java.sql.*, java.net.*, java.io.*, java.util.*"%>




<%@ 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">
<%@page import="java.util.Properties"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="css/style_ie.css">
<title>Search</title>
<%
      Connection conn = null;
      CallableStatement procCall, procCall1 = null;
      ResultSet rs = null;
      ResultSet rs1 = null;
      String Searchaction = "";
      try {
            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
            conn = DriverManager.getConnection("jdbc:sqlserver://nydev05:1433;Database=GTControl","GTCERTHub", "GTCERTHub");
            procCall = conn.prepareCall("{? = call GTControl..spqGetMarket()}");
            procCall.registerOutParameter(1, Types.BIGINT);
            rs = procCall.executeQuery();
            Searchaction = request.getParameter("btnSearch");
            if(Searchaction != null && Searchaction.equals("Search")){
                  procCall1 = conn.prepareCall("{? = call GTControl..spqSearchSecurities(?, ?, ?, ?)}");                       
                  procCall1.registerOutParameter(1, Types.BIGINT);
                  procCall1.setString(2, request.getParameter("marketList"));
                  procCall1.setString(3, request.getParameter("txtSymbol"));
                  procCall1.setString(4, request.getParameter("txtSedol"));
                  procCall1.setString(5, request.getParameter("txtIsin"));
//                String strIsin = request.getParameter("txtIsin");
//                String strMarket = request.getParameter("marketList");
//                if(((strIsin != null) || !(strIsin.equals(""))) && (strMarket == null || strMarket.equals("Select"))) {
//                out.println("<font color='red'><h4>Please enter ISIN and Market together.</h4></font>");
//                      procCall1.setString(5, "");
//                } else {
//                      procCall1.setString(5, request.getParameter("txtIsin"));
//                }

                  rs1 = procCall1.executeQuery();
                  List list = new ArrayList();
                  list.add(rs1);
            }
      } catch (Exception ex) {
            ex.printStackTrace();
      }
%>
</head>
<body>
<h1>Search Securities</h1>
<form name="frmSearch" action="Search.jsp" method="post">
<table border="0">
      <tr>
            <th class="body">Market</th>
            <td><select name="marketList" class="combo">
                        <option selected>Select</option>               
                  <%while(rs.next()){%>
                        <option value="<%=rs.getString(1)%>"><%=rs.getString(2)%></option>                 
                  <%} %>
            </select></td>
            <td>&nbsp;</td>
            <th class="body">Symbol</th>
            <td><input type="text" name="txtSymbol" size="15" class="bodyinput"></td>
            <td>&nbsp;</td>
            <th class="body">Sedol</th>
            <td><input type="text" name="txtSedol" size="15" class="bodyinput"></td>
            <td>&nbsp;</td>
            <th class="body">ISIN</th>
            <td><input type="text" name="txtIsin" size="15" class="bodyinput"></td>
            <td>&nbsp;</td>
            <td><input type="submit" value="Search" name="btnSearch" class="fBtn"></td>
      </tr>
</table>
</form>          
      <%if(Searchaction != null && Searchaction.equals("Search")){%>
      <TABLE BORDER="1">
        <TR>
               <TH class="tablehead">Select</TH>
               <TH class="tablehead">Symbol</TH>
               <TH class="tablehead">Sedol</TH>
               <TH class="tablehead">ISIN</TH>
               <TH class="tablehead">SymbolDesc</TH>
               <TH class="tablehead">Exchange</TH>
                     <TH class="tablehead">Market</TH>
               <TH class="tablehead">Country</TH>
               <TH class="tablehead">SpecialCtryCode</TH>                                            
               <TH class="tablehead">LseSegment</TH>                                                           
               <TH class="tablehead">ExchangeSec</TH>
               <TH class="tablehead">TradingSysType</TH>                                            
               <TH class="tablehead">PriceMultiplier</TH>                                                                          
               <TH class="tablehead">LotSize</TH>                                                            
               <TH class="tablehead">QLot</TH>
               <TH class="tablehead">RLot</TH>                                            
               <TH class="tablehead">ClosePrice</TH>                                                                                         
               <TH class="tablehead">HighPrice</TH>
               <TH class="tablehead">LowPrice</TH>                                            
               <TH class="tablehead">Volume</TH>  
               <TH class="tablehead">LastUpdateDate</TH>                                                                                         
               <TH class="tablehead">ChgBy</TH>
               <TH class="tablehead">ChgAt</TH>                                            
               <TH class="tablehead">isDeleted</TH>                                                                                                                       
               <TH class="tablehead">Currency</TH>                                                                                         
               <TH class="tablehead">Broker1</TH>
               <TH class="tablehead">RIC</TH>                                            
               <TH class="tablehead">RoutingGroup</TH>                                                                                                                                      
           </TR>
            <%while(rs1.next()) { %>         
           <TR>
                  <td><a href="Search.jsp?mode=Edit&Market=<%= rs1.getString("Market") %>&Symbol=<%= rs1.getString("Symbol") %> ">Edit</a></td>
               <TD class="body"> <%= rs1.getString("Symbol") %> </TD>
               <TD class="body"> <%= rs1.getString("Sedol") %> </TD>
               <TD class="body"> <%= rs1.getString("ISIN") %> </TD>
               <TD class="body"> <%= rs1.getString("SymbolDesc") %> </TD>
               <TD class="body"> <%= rs1.getString("Exchange") %> </TD>
               <TD class="body"> <%= rs1.getString("Market") %> </TD>
               <TD class="body"> <%= rs1.getString("Country") %> </TD>
               <TD class="body"> <%= rs1.getString("SpecialCtryCode") %> </TD>
               <TD class="body"> <%= rs1.getString("LseSegment") %> </TD>
               <TD class="body"> <%= rs1.getString("ExchangeSec") %> </TD>              
               <TD class="body"> <%= rs1.getString("TradingSysType") %> </TD>
               <TD class="body"> <%= rs1.getString("PriceMultiplier") %> </TD>
               <TD class="body"> <%= rs1.getString("LotSize") %> </TD>
               <TD class="body"> <%= rs1.getString("QLot") %> </TD>
               <TD class="body"> <%= rs1.getString("RLot") %> </TD>
               <TD class="body"> <%= rs1.getString("ClosePrice") %> </TD>
               <TD class="body"> <%= rs1.getString("HighPrice") %> </TD>
               <TD class="body"> <%= rs1.getString("LowPrice") %> </TD>
               <TD class="body"> <%= rs1.getString("Volume") %> </TD>
               <TD class="body"> <%= rs1.getString("LastUpdateDate") %> </TD>                             
               <TD class="body"> <%= rs1.getString("ChgBy") %> </TD>
               <TD class="body"> <%= rs1.getString("ChgAt") %> </TD>
               <TD class="body"> <%= rs1.getString("isDeleted") %> </TD>
               <TD class="body"> <%= rs1.getString("Currency") %> </TD>
               <TD class="body"> <%= rs1.getString("Broker1") %> </TD>
               <TD class="body"> <%= rs1.getString("RIC") %> </TD>
               <TD class="body"> <%= rs1.getString("RoutingGroup") %> </TD>
           </TR>

       <BR>      
       <%}} %>
       </TABLE>      
      <%
      URL myURL=application.getResource("/WEB-INF/fieldstatus.properties");
      InputStream in = myURL.openStream();
      Properties p = new Properties();
      p.load(in);
      String strAction = request.getParameter("mode");
      if(strAction != null && strAction.equals("Edit")){
            String sqlString = "select * from GTControl..Securities where Market = '" + request.getParameter("Market") +"'and Symbol = '" + request.getParameter("Symbol") +"'";
            Statement stmt = null;
            stmt = conn.createStatement();
            ResultSet rs3 = null;
            rs3 = stmt.executeQuery(sqlString);
      %>
      <form metdod="post" action="Search.jsp">
      <%if(rs3.next()) {%>
      <table border="0" widtd="100%" cellpadding="0" cellspacing="0" class="subNavTable">
            <tr>
                  <td class="body">Sedol</td>
                  <%if(p.getProperty("Sedol").equalsIgnoreCase("Disabled")) {%>
                        <td><input type="text" name="txtSedol" disabled="disabled" value="<%=rs3.getString("Sedol")%>" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtSedol" value="<%=rs3.getString("Sedol")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">ISIN</td>
                  <%if(p.getProperty("ISIN").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtISIN" value="<%=rs3.getString("ISIN")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtISIN" value="<%=rs3.getString("ISIN")%>" class="bodyinput"></td>
                  <%} %>
            </tr>
            <tr>
                  <td class="body">SymbolDesc</td>
                  <%if(p.getProperty("SymbolDesc").equalsIgnoreCase("Disabled")) {%>
                        <td>
                              <input type="text" name="txtSymbolDesc" value="<%=rs3.getString("SymbolDesc")%>" disabled="disabled" class="bodyinput">
                        </td>
                  <%} else { %>
                        <td>
                              <input type="text" name="txtSymbolDesc" value="<%=rs3.getString("SymbolDesc")%>" class="bodyinput">
                        </td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">Exchange</td>
                  <%if(p.getProperty("Exchange").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtExchange" value="<%=rs3.getString("Exchange")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtExchange" value="<%=rs3.getString("Exchange")%>" class="bodyinput"></td>
                  <%} %>
            </tr>
            <tr>
                  <td class="body">Market</td>             
                  <%if(p.getProperty("Market").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtMarket" value="<%=rs3.getString("Market")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                 
                  <td><input type="hidden" name="txtHiddenSymbol"  value="<%=rs3.getString("Symbol")%>">
                  <input type="text" name="txtMarket" value="<%=rs3.getString("Market")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">Country</td>
                  <%if(p.getProperty("Country").equalsIgnoreCase("Disabled")) {%>
                        <td><input type="text" name="txtCountry" value="<%=rs3.getString("Country")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                        <td><input type="text" name="txtCountry" value="<%=rs3.getString("Country")%>" class="bodyinput"></td>
                  <%} %>
            </tr>
            <tr>
                  <td class="body">SpecialCtryCode</td>
                  <%if(p.getProperty("SpecialCtryCode").equalsIgnoreCase("Disabled")) {%>
                        <td><input type="text" name="txtSpecialCtryCode" value="<%=rs3.getString("SpecialCtryCode")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                        <td><input type="text" name="txtSpecialCtryCode" value="<%=rs3.getString("SpecialCtryCode")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">LseSegment</td>
                  <%if(p.getProperty("LseSegment").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtLseSegment" value="<%=rs3.getString("LseSegment")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtLseSegment" value="<%=rs3.getString("LseSegment")%>" class="bodyinput"></td>
                  <%} %>
            </tr>
            <tr>
                  <td class="body">ExchangeSec</td>
                  <%if(p.getProperty("ExchangeSec").equalsIgnoreCase("Disabled")) {%>
                        <td><input type="text" name="txtExchangeSec" value="<%=rs3.getString("ExchangeSec")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                        <td><input type="text" name="txtExchangeSec" value="<%=rs3.getString("ExchangeSec")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">TradingSysType</td>
                  <%if(p.getProperty("TradingSysType").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtTradingSysType" value="<%=rs3.getString("TradingSysType")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtTradingSysType" value="<%=rs3.getString("TradingSysType")%>" class="bodyinput"></td>
                  <%} %>
            </tr>
            <tr>
                  <td class="body">PriceMultiplier</td>
                  <%if(p.getProperty("PriceMultiplier").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtPriceMultiplier" value="<%=rs3.getString("PriceMultiplier")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtPriceMultiplier" value="<%=rs3.getString("PriceMultiplier")%>" class="bodyinput"></td>              
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">LotSize</td>
                  <%if(p.getProperty("LotSize").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtLotSize" value="<%=rs3.getString("LotSize")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtLotSize" value="<%=rs3.getString("LotSize")%>" class="bodyinput"></td>                      
                  <%} %>
            </tr>                              
            <tr>
                  <td class="body">QLot</td>
                  <%if(p.getProperty("QLot").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtQLot" value="<%=rs3.getString("QLot")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtQLot" value="<%=rs3.getString("QLot")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">RLot</td>
                  <%if(p.getProperty("RLot").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtRLot" value="<%=rs3.getString("RLot")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtRLot" value="<%=rs3.getString("RLot")%>" class="bodyinput"></td>
                  <%} %>
            </tr>                              
            <tr>
                  <td class="body">ClosePrice</td>
                  <%if(p.getProperty("ClosePrice").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtClosePrice" value="<%=rs3.getString("ClosePrice")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtClosePrice" value="<%=rs3.getString("ClosePrice")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">HighPrice</td>
                  <%if(p.getProperty("HighPrice").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtdighPrice" value="<%=rs3.getString("HighPrice")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtdighPrice" value="<%=rs3.getString("HighPrice")%>" class="bodyinput"></td>              
                  <%} %>
            </tr>                              
            <tr>
                  <td class="body">LowPrice</td>
                  <%if(p.getProperty("LowPrice").equalsIgnoreCase("Disabled")) {%>
                        <td><input type="text" name="txtLowPrice" value="<%=rs3.getString("LowPrice")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                        <td><input type="text" name="txtLowPrice" value="<%=rs3.getString("LowPrice")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">Volume</td>
                  <%if(p.getProperty("Volume").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtVolume" value="<%=rs3.getString("Volume")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtVolume" value="<%=rs3.getString("Volume")%>" class="bodyinput"></td>                       
                  <%} %>
            </tr>                                                                  
            <tr>
                  <td class="body">LastUpdateDate</td>
                  <%if(p.getProperty("LastUpdateDate").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtLastUpdateDate" value="<%=rs3.getString("LastUpdateDate")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtLastUpdateDate" value="<%=rs3.getString("LastUpdateDate")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">ChgBy</td>
                  <%if(p.getProperty("ChgBy").equalsIgnoreCase("Disabled")) {%>
                  <td><input type="text" name="txtChgBy" value="<%=rs3.getString("ChgBy")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtChgBy" value="<%=rs3.getString("ChgBy")%>" class="bodyinput"></td>            
                  <%} %>
            </tr>                                                                  
            <tr>
                  <td class="body">ChgAt</td>
                  <%if(p.getProperty("ChgAt").equalsIgnoreCase("Disabled")) {%>                
                  <td><input type="text" name="txtChgAt" value="<%=rs3.getString("ChgAt")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtChgAt" value="<%=rs3.getString("ChgAt")%>" class="bodyinput"></td>
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">isDeleted</td>
                  <%if(p.getProperty("isDeleted").equalsIgnoreCase("Disabled")) {%>            
                  <td><input type="text" name="txtisDeleted" value="<%=rs3.getString("isDeleted")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtisDeleted" value="<%=rs3.getString("isDeleted")%>" class="bodyinput"></td>
                  <%} %>
            </tr>                                                                  
            <tr>
                  <td class="body">Currency</td>
                  <%if(p.getProperty("Currency").equalsIgnoreCase("Disabled")) {%>                               
                  <td><input type="text" name="txtCurrency" value="<%=rs3.getString("Currency")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtCurrency" value="<%=rs3.getString("Currency")%>" class="bodyinput"></td>               
                  <%} %>
                  <td>&nbsp;</td>
                  <td class="body">Broker1</td>
                  <%if(p.getProperty("Broker1").equalsIgnoreCase("Disabled")) {%>                                
                  <td><input type="text" name="txtBroker1" value="<%=rs3.getString("Broker1")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtBroker1" value="<%=rs3.getString("Broker1")%>" class="bodyinput"></td>
                  <%} %>
            </tr>                                                                                                      
            <tr>
                  <td class="body">RIC</td>
                  <%if(p.getProperty("RIC").equalsIgnoreCase("Disabled")) {%>                              
                  <td><input type="text" name="txtRIC" value="<%=rs3.getString("RIC")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtRIC" value="<%=rs3.getString("RIC")%>" class="bodyinput"></td>            
                  <%} %>
                  <td>&nbsp;</td>
                  <td>RoutingGroup</td>
                  <%if(p.getProperty("RoutingGroup").equalsIgnoreCase("Disabled")) {%>                                                   
                  <td><input type="text" name="txtRoutingGroup" value="<%=rs3.getString("RoutingGroup")%>" disabled="disabled" class="bodyinput"></td>
                  <%} else { %>
                  <td><input type="text" name="txtRoutingGroup" value="<%=rs3.getString("RoutingGroup")%>" class="bodyinput"></td>
                  <%} %>
            </tr>      
            <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><input type="submit" name="btnUpdate" value="Update" class="fBtn"></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
            </tr>                                                                                                      
      </table>
</form>

      <%} }
      String strUpdate = request.getParameter("btnUpdate");
      if(strUpdate != null && strUpdate.equals("Update")) {
            Statement stmt1 = null;
            stmt1 = conn.createStatement();
            ResultSet rs4 = null;
            String updateQuery = "update GTControl..Securities set Sedol = '" + request.getParameter("txtSedol") +
                  "', LotSize = " + request.getParameter("txtLotSize") +                 
                  ", RLot = " + request.getParameter("txtRLot") +                  
                  ", QLot = " + request.getParameter("txtQLot") +                  
                  ", isDeleted = " + request.getParameter("isDeleted") +                                   
                  ", RIC = '" + request.getParameter("txtRIC") +
                  "', ExchangeSec = '" + request.getParameter("txtExchangeSec") +              
                  "', ISIN = '" + request.getParameter("txtISIN") +
                  "' where Market = '" + request.getParameter("txtMarket")+"' and Symbol = '" + request.getParameter("txtHiddenSymbol") +"'";
            int i = stmt1.executeUpdate(updateQuery);
            out.println("Security Updated.");

      }
      %>

</body>
</html>




The information in this message, including any attachment, is confidential and intended for use only by the designated recipient(s) named above. It is the property of BNY ConvergEx Group, LLC or its affiliates. If you are not the intended recipient, please return the message to the sender and delete all copies of it, including attachments, from your computer. Unauthorized use, disclosure, dissemination or copying of this message or any part hereof is strictly prohibited. This message is for information purposes only, is not intended to provide a sufficient basis on which to make an investment decision and should not be regarded as an offer to sell or a solicitation of an offer to buy any financial product. The information expressed herein may be changed at any time without notice or obligation to update. Email transmission cannot be guaranteed to be secure, virus-free or error-free. Therefore, we do not represent that this message is virus-free, complete or accurate and it should not be relied upon as such. BNY ConvergEx Group, LLC and its affiliates accept no liability for any damage sustained in connection with the content or transmission of this message.