Hi all,
I'm using CQ5 to develop some things. and now i am not so clearly how to post a 'FORM' and accept with a SERVLET.
I've seen this 'http://forums.adobe.com/message/4932739#4932739' already, and try it. But once i add a new <input /> like :<input name="age" value="age" />.
and i submit this form, then tell me error: javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}age
see the code
jsp:
<!-- String action = /content/myproject/en/thanks -->
<form id="submitForm" method="post" action="<%= action %>.POST.html" onsubmit="return validate();">
<input type="hidden" name=":redirect" value="<%=resourceResolver.map(action)%>" />
<input type="hidden" name=":formpath" value="<%=currentNode.getPath()%>" />
<input type="hidden" name=":formtype" value="<%=component.getResourceType()%>" />
<input type="hidden" name="_charset_" value="utf-8" />
<input name="age" value="26" /> <!-- if i comment this line, it can submit success, otherwise show me Status: 500. -->
<input type="submit" value="Submit"/>
</form>
servlet:
@Component(immediate = true, metatype = false, label = "QuestionnaireServlet")
@Service
@Properties(value = {
@org.apache.felix.scr.annotations.Property(name = "sling.servlet.methods", value = { "POST" }),
@org.apache.felix.scr.annotations.Property(name = "sling.servlet.resourceTypes", value = { "sling/servlet/default" }),
@org.apache.felix.scr.annotations.Property(name = "sling.servlet.selectors", value = { "POST" }),
@org.apache.felix.scr.annotations.Property(name = "sling.servlet.extensions", value = { "html" })
})
public class QuestionnaireServlet extends SlingAllMethodsServlet implements
OptingServlet {
protected void doPost(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException,
IOException {
//it seems never call this function.
}
}
can anybody told me in details ?