Thanks for the reply. I use below code, similar to that only. But yours is more specific to CQ5. I will try to impliment.
PathInfo pathInfo = new PathInfo(request.getRequestURI().toString());
String pid = pathInfo.getSelectorString();
Have few doubts about the link you gave:
1) how they are retriving "selectors". Same way I am retriving?
2)Also they are telling to pass the argument "page" but the probel is whenever I pass argument to page it refreshes twice.
Is it important for you to use parameters which are attached to the URI or could you also use session attributes?
You can set session attributes with the following code:
HttpSession session = this.getSlingRequest().getSession();
and you can retrieve the attribute with:
Session attribute I can use when I wanted jsut few information to be stored related to entire page. But here my requirement is, I have lsit of products, and all those contains a link, this link I am generating at runtime, which points to perticular page.
<a href=/content/abc/page.html?pid=111">Prod 111</a>
<a href=/content/abc/page.html?pid=112">Prod 112</a>
<a href=/content/abc/page.html?pid=113">Prod 112</a>
Now I generate this page dynamically, I am not sure on which product user selects, based on the product link user selected, argument needs to be passed.
That is why I can not use session and need to pass it as argument. But now I am not using argument as mentioned above, I am using selecor in argument.