java - Setting value of input type date in jsp -


I'm trying to set the value in my input field, typed in my jsp page. The value is derived from the database is the string type, I want to set this date value in my input field.

My JSPP script is given below.

  & lt;% Op_Product opp = new Op_Product (); String pubdate = null; As a result RSE = opp.getOneProductWithId (request.getParameter ("prdid")); While (rse.next ()) {pubdate = rse.getString ("prdf7"); // value to set to input field}%>  

My html input type date field is below.

  & lt; Input id = "d-pubdate" type = "date" class = "form-save" name = "pubDate" value = "& lt;% = pubdate% & gt;" required & gt;  

I'm getting this error on "Bad value for feature, not completed literal date format".

The format is "YYYY-MM-DD".

In JSP, you can use locale-sensitive numbers and dates to parsing and formatting Provides a set of tags for

Read more

Sample code:

  & lt; C: set value = "10/23/2014 - 15:15:22" var = "datestring" /> & Lt; Fmt: parseDate value = "$ {dateString}" var = "dateObject" pattern = "mm / dd / yyyy - hh: mm: ss" /> & Lt; Fmt: formatDate value = "$ {dateObject}" pattern = "dd / MM / yyyy - hh: mm a" />  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -