java ee - How to convert a Date in a dynamically added input field (JSF) -


in application want enter date in <input> field programatically created jsf page.

the creation of input field looks this:

// input string jsfvalue = string.format("#{%s.item.%s}", getelclassname(), property.getkey()); valueexpression valueexpression = jsfutils.createvalueexpression(jsfvalue, property.getvalue());  htmlinputtext input = (htmlinputtext) app.createcomponent(htmlinputtext.component_type); input.setid(property.getkey()); input.setvalueexpression("value", valueexpression); 

the property instance of java.util.date , <input> field htmlinputtext component without converter assigned it.

when <input> tag rendered, following value can seen date:

tue mar 11 18:31:20 cet 2014 

if know want save form, jsf page complains format of date because not able convert input value java.util.date.

can tell me how can create converter programatically htmlinputtext component?

when using myfaces application conversion done automatically because never had problem before.

datetimeconverter converter = (datetimeconverter) application.createconverter(date.class); converter.setpattern(somepattern); input.setconverter(converter); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -