Hello! I meet this problem some months ago. I made a solution using XSP. I think you can easily enhance this piece of code:
<xsp:logic> String key = <xsp-request:get-parameter name="table_id" default=""/>; while (key.equals("")) { Random aleatorio = new Random(); int new_key = aleatorio.nextInt(Integer.MAX_VALUE) + 1; llave = String.valueOf(new_key); /* Check into database if the key exist into the table */ <esql:execute-query> <esql:query> SELECT table_id FROM table WHERE table_id=<esql:parameter type="int"><xsp:expr>new_key</xsp:expr></esql:parameter> </esql:query> <esql:results> <esql:row-results> key = ""; </esql:row-results> </esql:results> </esql:execute-query> } </xsp:logic> <parameter name="table_id"><xsp:attribute name="value"><xsp:expr>key</xsp:expr></xsp:attribute></parameter> best regards, Antonio Gallardo --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]