Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8215585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:50:23+00:00 2026-06-07T11:50:23+00:00

I am having a problem handling date variables when I write to PostgreSQL using

  • 0

I am having a problem handling date variables when I write to PostgreSQL using JSP forms. There has been some great tips but still can not get it right. I believe that I am passing a String from JSP to JAVA where it is a Date “setter” and “getter” writing to PSQL on a “date without time zone” column.

Here is parts of the JSP code related to the Date:

…. (some code) ….

SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");

…. (mode code) ….

<%

if (action.equals("add")) {
  .
  .
  .

  newCampaign.setCampempDate(dateFormat.parse(request.getParameter("campemp")));

  newCampaign.add();
}  
%>

…. (more code) ….

               <input name="campemp" type="text" class="datePickBox" id="campemp"
 onBlur="javascript:checkFormat(this)" value="<%= defaultCampaign.getCampempDate() != null 
? dateFormat.format(defaultCampaign.getCampempDate()) : dateFormat.format(new 
java.util.Date()) %>" size=20>

…. (rest of code) ….

It is important to mention that on the input I am also using a calendar that passes the date with the correct format… this is another reason I am using a date field on the JSP side.

On the JAVA side:

…. (some code) ….

  private java.util.Date campemp= null; 

  private SimpleDateFormat userDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");

… (more code) … ++ Set and Get ++

public void setCampempDate(java.util.Date aCampemp) {    
    this.campemp= aCampemp;
  }


 public java.util.Date getCampempDate() {
    return this.campemp;  
  }

… (more code) … ++ LOAD ++

  public void load(ResultSet rs) throws SQLException {
   this.setId(rs.getLong("campkeydbid"));
    .
    .
  this.setCampempDate(rs.getDate("campemp"));
}

… (more code) … ++ WRITE TO DB ++

public boolean add() throws SQLException {
boolean success = false;
if (costingEnabled) {
  String call = "select " + getStoredProcedureMapper().getPrefix() + "_Add(?,?,?,?,?,?,?,?,?,?)";
  DataSource ds = PoolMan.findDataSource("mydatabase");
  Connection conn = null;
  try {
    conn = ds.getConnection();
    PreparedStatement pst = conn.prepareStatement(call);
      .
      .
    pst.setTimestamp(10, new Timestamp(this.getCampempDate().getTime())); 
 ResultSet rs = pst.executeQuery();
    if (rs.next()) {
      .
      .

… (more code) …

The “_Add” on the stored procedure is correct as it works if I “hardcode” the date on the pst.SetTimestamp

The error I am getting is the following:

org.apache.jasper.JasperException: Unable to convert string “04/07/2012 19:12” to class “java.util.Date” for attribute “campemp”: Property Editor not registered with the PropertyEditorManager

Any ideas on a workaround to parse the String to Date without affecting the DB date field and JSP input will be greatly appreciated.. thank you very much.

Regards,

Rob

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:50:25+00:00Added an answer on June 7, 2026 at 11:50 am

    org.apache.jasper.JasperException: Unable to convert string “04/07/2012 19:12” to class “java.util.Date” for attribute “campemp”: Property Editor not registered with the PropertyEditorManager

    You are passing Date in String in 04/07/2012 19:12 format so you need to use

    dd/MM/yyyy HH:mm
    

    From the code you posted, It seems you are using

    private SimpleDateFormat userDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    

    as format in SimpleDateFormat

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with my ActiveRecord exception handling and I suspect some of
I'm having a problem handling JSON data within JavaScript, specifically in regards to using
I am writing a program in Qt c++ and I'm having some problem handling
I'm having a problem handling some numbers from a json request. Based on the
I'm having some problem handling the JS onClick event and Dojo. Waht i'm trying
I'm having a problem with handling an event on a different thread from where
I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working
Im having a little problem on handling touches in my apps. I set my
I'm having a problem passing pointers to native code using COM. I want to
I am having a problem handling large numbers. I need to calculate the log

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.