adobe - Not able to post form in Adode CQ5 -


I'm a newbie in AdobeCQ5, I'm facing some trouble in the posting form. Here's my structure -

  / apps /   

mytestcomopnent.jsp has the code -

  & lt; Form id = "myForm" action = "& lt;% = resource.getPath () +". Html "%" & Gt; & Lt; Input type = "text" id = "t1" class = "input-small" placeholder = "Temprature F" /> & Lt; Input type = "text" id = "t2" class = "input-less" placeholder = "Temprature C" read-only /> & Lt; Button type = "button" id = "cbtn" class = "btn" & gt; Convert & lt; / Button & gt; & Lt; / Form & gt; & Lt; Script & gt; ARTR ("Action"); Alert (url); Var T1 (ARTR) = $ ("# T1"). Val (); Var t2 = $ ("# t2"). Val (); $ .ajax ({url: URL, data: {'t1': t1}, type: "val (data);}, error: work (xhr, txtStat, errThrown) {warning (" Ajax error! "+ TxtStat + ":" Successfully: function (data, position) {$ ("# t2"). :: "+ erretrown);}});});}); & Lt; / Script & gt;   

This is my response code 200 (success), but output is not desired My mycomponent.POST.jsp has the code -

  & Lt;% // TODO adds code here to string T1 = request.getParameter ("t1"); & Gt%; & Lt;% = t1% & gt;   

This gives the following output

  Content modified / content / mobile / / jcr: content / social.html position 200 message fine location / content / iMobile / N / _jcr_content / social.html Parent Location / Content / iMobile / N / _jcr_content Path / Content / Mobile / AN / JCR: Content / Socio / HTML Referrer http: //example.comt: 4502 / Content / Immobil / N. HML Change Lodge & lt; Pre & gt; & Lt; / Pre & gt;   

Your components The JSP file handling the POST method should be named mycomponent.POST.jsp instead of POST.jsp .

Please note that if you block the POST request in all your parts, you will not be able to edit it on the basis of the dialog (as the dialog only posts data to the component URL) . To avoid this, consider using custom selectors (like form ). Your form should be declared as:

  & lt; Form id = "myForm" action = "$ {resource.path} .form.html" & gt;   

and the script that handles the post request should be called form.POST.jsp .

Another important thing is that you should use Java classes to store business logic rather than JSP files. In this case, this means that form.POST.jsp The script can be declared as a declaration, as follows:

  @SlingServlet (resourceTypes = "myproject / components / mytestcomponent", methods = "post", selector = "form")    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -