search - Post Form to a page in CQ5 -


I have a Custom Search Component that searches for some parameters from the dropdown [myParam] and Displays the search results on the second page. I currently use the default (GET) form

  & lt; Use form id = "searchForm" action = "/ content / myWeb / searchResult.html" method = "get" target = "_ blank" & gt; ;   

In the results page, a component raises the request parameter and processes the search.

I need to make this a post submission so that the search parameter is not displayed in the url. But if I make it a method = "post" , I get this error:

  status 500 message javax.jcr.nodetype.ConstraintViolationException : No {} found a similar property definition / content / myWeb path / path / in / search / page    

This exception occurs in a casual way which sling tells you that the postal you are trying to do is not a subnet I can get it. What happens, in this case, that SlingDefaultPostServlet is sling default, which attempts to post properties (according to your form values) there is no way to say node / content / myweb / search result sling A servicelet registered in your service is not available ", so it is only returned to default behavior.

I'm assuming / content / my web / search is a cq: page node type This node type is very restrictive, that is why it tells you that you do not have the property corresponding to your form values can add.

This works first, because your GET request at / content / myWeb / searchResult.html was able to resolve and execute all requests for a page node be served naturally by the request system May be.

Now, since you are trying to post one, you need to create and register a new servlet which can handle this post request. To do this, you will need to create and register it in your specific path (not recommended) or in a specific selector / extension combination (recommended). That servlet should act on the request parameters and respond with an HTML document.

A warning ...

What I have just described, you will technically help you in creating what you are asking for. He said, I do not agree with the condition that you "make this a post to hide the request parameters." The reason for this is a lot of work, because you are rejecting the principles of REST, which is designed to support sling theoretically. Your URL (via the request path and the criteria) should be communicated on "I want the value / value on the content / myWeb / searchResult param1 = x, param2 = y, and so on". GEEEP is a reasonable request with request parameters.

I suggest that you think again what you are trying to do is to create a more complex solution around silk principles is not a good practice.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -