Hi Team,
I am trying to post table data from my form to the POST.jsp using the following approach.
$.ajax({
type: 'POST',
url: '/url to the component's node/Organization.POST.jsp',
data: {
'orgName': orgName,
'orgPhNum': orgPhNum,
'orgProgram': orgProgram,
'orgAddress': orgAddress,
'orgCity': orgCity,
'orgState': orgState,
'orgZipCode': orgZipCode,
'datePicker': datePicker,
'problemReproducible': problemReproducible,
'locations': locationArr,
'people': peopleArr,
'fileDetails': fileArr
},
success: function(data) {
//alert(data);
},
failure: function(data) {
//alert("failed");
}
});
});
I was able to get all the data in Servlet for a different case following the same approach .Not sure what path to give to make it work for POST.jsp as well
Solved! Go to Solution.
Views
Replies
Total Likes
Hi
There is one more Helpx Article that is uploading an image. Here also we are posting image stream via POST method, and at the OSGI level (servlet) we are catering it with doPost ();
Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html
// Here we are sending FormData Via Ajex call which is having POST as a Method.
$.ajax({
type: 'POST',
url:'/bin/updamfile',
processData: false,
contentType: false,
data:formData,
success: function(msg){
alert(msg); //display the data returned by the servlet
}
});
Please have a look at this one, i hope this would help you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Posting data to a post.POST.jsp is typically from an Adoptive form. See:
https://helpx.adobe.com/experience-manager/using/posting-aem-6-form-data.html
If you are using AJAX outside of an adaptive form (ie - a JSP) - consider posting to an AEM Sling Java Servlet.
See:
https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Views
Replies
Total Likes
Was able to post form(Non adaptive one) details to servlet.
It had issues then accessing the Datasource Connection defined in the osgi configurations.
That is the reason I tried using POST.jsp approach.
Views
Replies
Total Likes
If you want to store data into a relational database from a servlet - use a DataSourcePool. This is the best practice. See this AEM community article that shows how to perform this use case:
https://helpx.adobe.com/experience-manager/using/custom-sling-servlets1.html
This shows you How To get a DataSourcePool into a Sling Servlet. This way you can post to Servlet and then use DataSourcePool to get the data into a database.
Views
Replies
Total Likes
Thanks for your response.
I tried using the shared article and ended up getting "No suitable driver found error".
I have the Oracle driver jar installed as bundle and I am able to connect to database using Data connection pool when using POST.jsp upon HTML form submission in AEM.
Views
Replies
Total Likes
Hi
There is one more Helpx Article that is uploading an image. Here also we are posting image stream via POST method, and at the OSGI level (servlet) we are catering it with doPost ();
Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html
// Here we are sending FormData Via Ajex call which is having POST as a Method.
$.ajax({
type: 'POST',
url:'/bin/updamfile',
processData: false,
contentType: false,
data:formData,
success: function(msg){
alert(msg); //display the data returned by the servlet
}
});
Please have a look at this one, i hope this would help you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Make sure you have the JSP files you are posting to in the correct location. See this example whick works: https://helpx.adobe.com/experience-manager/using/querying-experience-manager-sling.html
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies