PLEASE HELP!!!
This is the code in my
JSP that I am trying to get to work:
<script language="JavaScript1.2">
var a = parseInt(document.Check.Barcode.value);
var b = parseInt(document.Check.largestBarcode.value);
if(a > b)
{
alert("Sorry, you must enter a barcode that is greater than the one you just entered");
return false;
}
}
</script>
<tr>
<input type="hidden" name="largestBarcode" value="<%=(adminFunctions.lastBarcode(libraryBook))%>">
This is my bean method that gets the largest number form my database:
public synchronized int lastBarcode (Resource resource)
{
Vector vResourceList = new Vector();
String[] alResourceList = null;
int nArraySize = 0;
double fValue = 0;
Double tempDouble;
int nBarcode = 0;
try
{
m_Statement = m_Connection.createStatement();
m_Results= m_Statement.executeQuery (m_strBarcode);
while (m_Results.next())
{
vResourceList.addElement(new String(m_Results.getString("scancode")));
}
m_Statement.close();
}
catch (SQLException queryFails)
{
System.out.println("Exception retrieving resource list " + queryFails.getMessage());
}
alResourceList = new String[vResourceList.size()];
//Moving into array to use in JSP page
vResourceList.toArray(alResourceList);
//Getting the size of the array
nArraySize = (alResourceList.length);
tempDouble = Double.valueOf(alResourceList[nArraySize-1]) ;
fValue = tempDouble.doubleValue() ;
nBarcode = (int)fValue;
return (nBarcode);
}