use interceptors to set values for creation_date and
other values before the insert  event, look  in the
examples directory ,  
  
/bookstore/WEB-INF/src/interceptors/BookstoreInsertDataInterceptor.java

i use it  for this purpose, i change the preInsert
method for this

 public int preInsert(HttpServletRequest request,
                        Table              table,
                        FieldValues       
fieldValues,
                        DbFormsConfig      config,
                        Connection         con) throws
ValidationException {
      String     fieldName = table.getName() + "_ID";
      FieldValue fv        =
fieldValues.get(fieldName);

         String qry = "select sysdate() ";
         String fecha="";

         try {
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery(qry);
            rs.next();
            fecha  = rs.getString(1);
            stmt.close();
         } catch (SQLException e) {
            e.printStackTrace();
         }

         setValue(table, fieldValues,
"fecha_creacion", fecha);
         setValue(table, fieldValues,
"fecha_modificacion", fecha);

      return GRANT_OPERATION;
   }


--- Bill Tribley <[EMAIL PROTECTED]> wrote:
> I have a form working perfectly except that the
> creation date is null. I  
> want to use a hidden textField with an overrideValue
> that will force this  
> creation date to be the system date at the time the
> page loads.
> 
> Any ideas on how I could find out what would throw
> this exception? Log  
> does not point to any jsp page number:
> 
> At webapp reload:
> 2005-04-06 00:31:47
> StandardContext[/manager]Manager: restart: Reloading
>  
> web application at '/prayerdb'
> 2005-04-06 00:31:52
> StandardContext[/prayerdb]config: finalizing
> 2005-04-06 00:33:09 ApplicationDispatcher[/prayerdb]
> Servlet.service() for  
> servlet jsp threw exception
> java.lang.ThreadDeath
>          at  
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1229)
>          at  
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
> 
> At page reload after webapp reload:
> 2005-04-06 00:33:09 StandardWrapperValve[control]:
> Servlet.service() for  
> servlet control threw exception
> java.lang.ThreadDeath
>          at  
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1229)
>          at  
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
>          at
>
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>          at
>
org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:145)
>          at
>
org.apache.log4j.Category.forcedLog(Category.java:372)
>          at
> org.apache.log4j.Category.log(Category.java:864)
> 
> My code to implement the date:
> 
> <%@ taglib uri="/WEB-INF/dbforms.tld" prefix="db" %>
> <html>
> <%@ page import="java.util.Date,java.text.*" %>
> <%!
> Date d = new Date();
> SimpleDateFormat df = new
> SimpleDateFormat('yyyy-MM-dd k:mm:ss');
> %>
> 
> ---- code removed for clarity, line below is a test
> expression in the body  
> -----
> 
> The Date Is <%= df.format(d); %>
> 
> 
> 
> 
> Thanks in advance for any insight.
> 
> Bill
> 
> 
>
-------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT
> Products from real users.
> Discover which products truly live up to the hype.
> Start reading now.
>
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> DbForms Mailing List
> 
> http://www.wap-force.net/dbforms
> 

_________________________________________________________
Do You Yahoo!?
Informaci�n de Estados Unidos y Am�rica Latina, en Yahoo! Noticias.
Vis�tanos en http://noticias.espanol.yahoo.com


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to