I have object in manage bean , and it include address . I want display to user interface home number input text , street name input text...ect . but in database just has address column . how create input text for each one the aggregation it in address ( when submit all values , it will data store in address column in database ) . how do this business?
I don't want change my database and use input mask.
thanks.
I using jsf ,primefaces, java 2ee
Asked
Active
Viewed 194 times
0

Jasper de Vries
- 19,370
- 6
- 64
- 102

Noah Jamal
- 11
- 2
-
2See https://stackoverflow.com/questions/11160192/how-to-parse-freeform-street-postal-address-out-of-text-and-into-components – Jasper de Vries Feb 09 '21 at 06:42
1 Answers
0
When you click on submit store home number input text , street name input text...ect in JSON format into the address filed then when you are loading parse that and take value based on the key.
{ "homenumber": "xyz", "name":"abc", "street":"123" }
when you are loading the page you would be having the entity object and take the address column value and parse like below and assign to each managed bean field.
ObjectMapper mapper = new ObjectMapper();
String json =entity.getAddress();
JsonNode actualObj = mapper.readTree(json);beanHomeNumber= actualObj.get("homenumber").toString();beanStreet= actualObj.get("street").toString();beanName= actualObj.get("name").toString();
Here beanHomeNumber, beanStreet, beanName are managed bean fileds.

Sai Ram
- 63
- 1
- 8