On form submission getting the following error: javax.jcr.nodetype.ConstraintViolationException: No matching property definition: txn_type = PP

supersoftr30476

15-10-2015

Hi,

I've my form as something like this:

t1.jsp:

<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>
<%@ page language="java" %>

<form name="frm" method="POST" id="frm" action="<%=resource.getPath()%>.html">
    <div>Enter your name<input type="text" name="nameX"/></div>
<input type="submit" name="submit" value="test"/>
</form>

 

POST.jsp:

<%@include file="/libs/foundation/global.jsp"%>
<%@ page session="false"%>
<%
String transaction_type = request.getParameter("namex");
log.info("teststttttt"+transaction_type);
%>

 

 

 

I'm getting error:

*ERROR* [127.0.0.1 [1437981615101] POST /content/abc/en/t1.html HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
javax.jcr.nodetype.ConstraintViolationException: No matching property definition: nameX = kjkjkjkj

Accepted Solutions (1)

Accepted Solutions (1)

smacdonald2008

15-10-2015

When posting data from an HTML form to AEM - post the data to  a Sling Servlet using AJAX. See this community article:

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

You have much better control over how to process data by writing app logic in the Slign Servlet. IN this example - the posted data is encoded to JSON using the Simple JSON API. 

Answers (1)

Answers (1)

supersoftr30476

15-10-2015

Thanks Scott,

I have already did that and it worked very smoothly that way, but don't we have any simpler way to submit forms to a jsp file in CQ?

E.g. Suppose if my form is like <form action="submit_form.jsp" method="post">

then this won't work in case of adobe CQ, I just want to post all data of my form to second page and if I use servlets, then it would be bit lengthier to get the data first and then arrange it in proper format and send back to second page.