Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to add path param to sling servlet url ?

Avatar

Not applicable

How to add path param to sling servlet url ? 

eg, /services/demo/path/{var1}/{var2}.html

1 Accepted Solution

Avatar

Correct answer by
Level 10

I assume you are looking for a similar way to place variables in paths of a URL - like you can with Spring - ie:

 @RequestMapping(value = "/{id}/ViewMyForm.do", method = RequestMethod.POST)

However - in Sling - a Request Parameter syntax is as follows. 

Request Parameters

A request parameter is like an input to a function. If you know you have some kind of operation that occurs at /get/me/some/info.json, you can attach request parameters to your GET request URI to retrieve the output of that servlet. For example, /get/me/some/info.json?on=football tells the servlet that you want some information on football.

- See more at:

http://www.citytechinc.com/us/en/blog/2013/08/apache-sling-selectors-request-parameters.html

http://stackoverflow.com/questions/20984706/is-it-possible-to-place-variables-into-a-resource-path-w...

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

I assume you are looking for a similar way to place variables in paths of a URL - like you can with Spring - ie:

 @RequestMapping(value = "/{id}/ViewMyForm.do", method = RequestMethod.POST)

However - in Sling - a Request Parameter syntax is as follows. 

Request Parameters

A request parameter is like an input to a function. If you know you have some kind of operation that occurs at /get/me/some/info.json, you can attach request parameters to your GET request URI to retrieve the output of that servlet. For example, /get/me/some/info.json?on=football tells the servlet that you want some information on football.

- See more at:

http://www.citytechinc.com/us/en/blog/2013/08/apache-sling-selectors-request-parameters.html

http://stackoverflow.com/questions/20984706/is-it-possible-to-place-variables-into-a-resource-path-w...