cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Painter-Wakefield <>
Subject Re: Problems with date and xsp
Date Sat, 03 Jan 2004 19:45:50 GMT
You are instantiating your Date variable at the class level, when the page 
is instantiated.  Cocoon re-uses the page object (just calling the 
generate() method each time), AFAIK.  So you need to put your Date 
instantiation inside the generate() method by doing the logic block inside 
<addcomment>.  That way you will get the current date each time the page 
is requested, instead of just the first time.


Davide <>
01/03/2004 02:26 PM
Please respond to users

        Subject:        Problems with date and xsp

Hi, i have some problems in getting the actual timestamp to put it into a 

My xsp is:

<?xml version="1.0"?>

<xsp:page language="java"
                                 java.util.Date now=new java.util.Date();

                                 <page-title>Add a comment</page-title>
                                 <!-- header bar background source file 
                                 <!-- mcnavigator css -->
 <esql:query>Insert into comments (User_ID, Comment_text, Commented_URL, 
Comment_Date, Comment_browser) values (
  '<xsp-session-fw:getxml context="authentication" 
  '<xsp-request:get-parameter name="comment_text"/>',
  '<xsp-request:get-parameter name="link"/>',
  '<xsp:expr>new java.sql.Timestamp(now.getTime())</xsp:expr>',
  '<xsp-request:get-header name="user-agent"/>')
 <esql:error-results>An error occurred</esql:error-results>
  <message>Your comment has ben added; you can now close this 

The problem is that every time i add a new record to the db using this xsp 

i notice that the time doesn't change. Any solution??

Best Regards, Davide

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message