0

what i am doing right now is appending a form created in javascript to the page. normal tag get appendend but when i try to append the spring form tag it wont work is there any way i can accomplish it.the application is single page app.so the form are generated in javascript and appended in the html.

function createPage(){
 var htmlcontent="<div class='box-content'>"

                +"<form:form action='UserController/addUser' id='userAddForm' method='post' commandName='userObj'>"

                +"<div class='form-group'>"
                +"<label class='control-label'>First Name</label>"
                +"<form:input path='firstname' class='form-control'/>"
                +"</div>"
                +"</div>"
$("#content").html(htmlcontent);

}

1 Answer 1

2

You can't dynamically create spring forms with javascript. You can create a spring form in your jsp which is compiled at server side and then transfered to your browser.

The server side needs to know which forms and input elements are managed to handle them.

Sign up to request clarification or add additional context in comments.

1 Comment

Yup realized it but is there any way if possible to achieve it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.