Hi Henner,
I'm already doing that, look this:
try {
System.out.print(query);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
System.out.print(rs);
if (rs.next())
{
//return IGNORE_OPERATION;
throw new ValidationException("my custom error message.");
}
else {
return GRANT_OPERATION;}
}catch (Exception e) {
e.printStackTrace();
return DENY_OPERATION;
}
but I can't see any error message on the web page.
best regards,
Alfred Certain
Contacta CRM Development Group
www.contactacrm.com
Mensaje citado por Henner Kollmann <[EMAIL PROTECTED]>:
> Just throw an new validation exception. Message of this exception should be
> you custom error message.!
>
> Cheers,
> Henner
>
> > -----Ursprüngliche Nachricht-----
> > Von: Contacta Development [mailto:[EMAIL PROTECTED]
> > Gesendet: Freitag, 12. August 2005 00:59
> > An: [email protected]
> > Betreff: [dbforms] Interceptor and Error listing
> >
> > Dear All,
> >
> > I'm trying to use interceptor with dbforms and they work
> > fine, but I can't find a way to show my custom error message
> > on the related JSP, it's just on the tomcat log, and the
> > error tag on the JSP just shows some null errors, something like this:
> >
> > Error:
> >
> > * null
> >
> > Extra info:
> >
> > 1) This is my dbforms-config.xml section:
> >
> > <table name="servicios"
> > defaultVisibleFields="ser_id" >
> > <field name="ser_id" fieldType="int4"
> > size="4" isKey="true"
> > autoInc="true"/>
> > <field name="ser_nombre" fieldType="varchar"
> > size="30"/>
> > <field name="ser_codigo" fieldType="varchar"
> > size="4"/>
> > <field name="ser_descripcion"
> > fieldType="varchar" size="255"/>
> > <field name="ser_tsr_id" fieldType="int4" size="4"/>
> > <field name="ser_emp_id" fieldType="int4" size="4"/>
> > <field name="ser_cue_id" fieldType="int4" size="4"
> > isKey="true"/>
> > <field name="ser_srv_id" fieldType="int4" size="4"/>
> > <field name="ser_esr_id" fieldType="int4" size="4"/>
> > <field name="ser_valor" fieldType="varchar"
> > size="999"/>
> >
> > <interceptor
> > className =
> > "com.contacta.crm.interceptor.InterceptorServicio"
> > />
> >
> > </table>
> >
> > 2) This is the preInsert method code:
> >
> > public int preInsert(HttpServletRequest request,
> > Table table,
> > FieldValues fieldValues,
> > DbFormsConfig config,
> > Connection con) throws ValidationException {
> >
> > String ser_nombre =
> > fieldValues.get("ser_nombre").getFieldValue();
> > String ser_codigo =
> > fieldValues.get("ser_codigo").getFieldValue();
> > String ser_srv_id =
> > fieldValues.get("ser_srv_id").getFieldValue();
> > System.out.print(ser_nombre);
> > String query = "SELECT ser_nombre, ser_codigo,
> > ser_srv_id FROM servicios WHERE ser_nombre='"+ser_nombre+"'"
> > +"OR ser_codigo='"+ser_codigo+"'AND
> > ser_srv_id='"+ser_srv_id+"'";
> > try {
> > System.out.print(query);
> > Statement stmt = con.createStatement();
> > ResultSet rs = stmt.executeQuery(query);
> > System.out.print(rs);
> > if (rs.next())
> > {
> > //return IGNORE_OPERATION;
> > throw new ValidationException("El
> > nombre de servicio o el codigo ya existen.");
> > }
> > else {
> > return GRANT_OPERATION;}
> >
> > }catch (Exception e) {
> > e.printStackTrace();
> > return DENY_OPERATION;
> > }
> > }
> >
> > 3) And this is the error messaje on the tomcat log:
> >
> > TESTYSELECT ser_nombre, ser_codigo, ser_srv_id FROM servicios
> > WHERE ser_nombre='TESTY'OR ser_codigo='1111'AND
> > ser_srv_id='1'[EMAIL PROTECTED]
> > bforms.config.ValidationException:
> > The service name already exists.
> >
> > I would really appreciate any ideas to solve this. I have
> > worked too much hours without success and have no more time.
> >
> > Thanks in advance to all dbforms community !!!!
> >
> > Alfred Certain
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference &
> > EXPO September 19-22, 2005 * San Francisco, CA * Development
> > Lifecycle Practices Agile & Plan-Driven Development *
> > Managing Projects & Teams * Testing & QA Security * Process
> > Improvement & Measurement * http://www.sqe.com/bsce5sf
> > _______________________________________________
> > DbForms Mailing List
> >
> > http://www.wap-force.net/dbforms
> >
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> DbForms Mailing List
>
> http://www.wap-force.net/dbforms
>
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
DbForms Mailing List
http://www.wap-force.net/dbforms