[英]How to generate dynamic form based on my json response from URL in java framework (JSF)?
I want to create dynamic form based on my json data in my browser,I know this is possible from using some javascript library like inputex etc but I am not expert in using javascript,I have made application using jsf 2.0 , I wanted some solution in Java, some thing like android , where we can easily create any type of UI dynamically, here is my json from which I need to create form , I can modify this response for any help as this json is also made by me. 我想在浏览器中基于json数据创建动态表单,我知道可以通过使用某些JavaScript库(例如inputex等)来实现,但我不是使用JavaScript的专家,我已经使用jsf 2.0编写了应用程序,我想要一些解决方案Java,例如android之类的东西,我们可以轻松地动态创建任何类型的UI,这是我需要创建表单的json,我可以修改此响应以获取任何帮助,因为该json也是我制作的。
{
surveyQuestions: [3]
0: {
choice: [3]
0: "choice1"
1: "choice2"
2: "choice3"
-
date: "2013-10-30T00:00:00+05:30"
q_id: "10"
question: "Question 1?"
questionType: "single_choice"
surveyType: "first_survey"
versionid: "1.1"
}-
1: {
choice: [5]
0: "choice0"
1: "choice1"
2: "choice2"
3: "choice3"
4: "All of Above"
-
date: "2013-10-30T00:00:00+05:30"
q_id: "11"
question: "Question 2?"
questionType: "multiple_choice"
surveyType: "first_survey"
versionid: "1.1"
}-
2: {
choice: [4]
0: "choice1"
1: "choice2"
2: "choice3"
3: "choice4"
-
date: "2013-10-30T00:00:00+05:30"
q_id: "12"
question: "Question 3?"
questionType: "single_choice"
surveyType: "first_survey"
versionid: "1.1"
}-
-
}
Instead of using javascript, read that json in your backing bean / controller and work with that. 而不是使用javascript,请在您的后备bean /控制器中读取该json并进行处理。
You should transform that json in an appropiate list of objects that you can use in java. 您应该在可以在Java中使用的适当对象列表中转换该json。 If you need a library to work with json in java, look at the answers of this question: https://stackoverflow.com/q/338586/1073063
如果需要使用Java中的json的库,请查看以下问题的答案: https : //stackoverflow.com/q/338586/1073063
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.