Karam,
Did you try printout of request.requestURL, and what value did you see.
Is your login.jsf reads the request parameter dest, and reidirects
appropriately?
thx
Senthil
Karam Singh wrote:
> Ken,
> I have the following code in initPage
>
> <!initPage
> redirect(page="login.jsf?dest=#{request.requestURL}");
> />
>
> Strangely it gets redirected to login.jsf without the "dest=<url of
> the page where its coming from>". Am I doing something wrong in the
> above code?
>
> thanks
> Karam
>
> Ken Paulsen wrote:
>>
>> Hi Karam,
>>
>> I added the following to the top of the test page that I wrote below:
>>
>> <!initPage
>> println("hi! '#{request.requestURL}'");
>> />
>>
>> println() writes a log message to the server.log... I checked and the
>> correct value for the requestURL was written in the log:
>>
>> [#|2008-01-16T23:52:46.067+0000|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-3;|
>>
>> hi! 'http://localhost:8080/demo/j.jsf'|#]
>>
>> Make sure your initPage event is at the top of your file.
>>
>> I hope this helps,
>>
>> Ken
>>
>> Karam Singh Badesha wrote:
>>> Ken,
>>> If I try to use #{request.requestURL} inside a initPage event, it
>>> doesn't work. Is that how its supposed to work?
>>>
>>> thanks
>>> Karam
>>>
>>> Ken Paulsen wrote:
>>>>
>>>> Hi Karam,
>>>>
>>>> You can get this information from the request object. If you want
>>>> to do this from w/i a JSFT .jsf page, you can do this via an EL
>>>> expression. If you cut/paste the following into a .jsf page in
>>>> your application you can see what these do:
>>>>
>>>> "ContextPath: #{request.contextPath}<br />
>>>> "QueryString: #{request.queryString}<br />
>>>> "RequestURI: #{request.requestURI}<br />
>>>> "RequestURL: #{request.requestURL}<br />
>>>> "ServletPath: #{request.servletPath}<br />
>>>>
>>>> For JSF w/ a *.jsf servlet mapping, the last one will give you want
>>>> you want.
>>>>
>>>> If you want to do this via Java, then you can get some of this
>>>> information from the ExternalContext. The rest can be obtained
>>>> directly from the request object (although you'll have to cast to
>>>> ServletRequest or HttpServletRequest... meaning your code won't
>>>> work in a Portlet environment). You can get the ExternalContext &
>>>> request object by doing:
>>>>
>>>> FacesContext.getCurrentInstance().getExternalContext()
>>>>
>>>> externalContext.getRequest()
>>>>
>>>> I hope this helps!
>>>>
>>>> Ken
>>>>
>>>> Karam Singh Badesha wrote:
>>>>> Hi,
>>>>> e.g. One of the page in my app is http://host/CADRe/test.jsf
>>>>>
>>>>> Is there a way to get the url after the "http://host/CADRe/" in
>>>>> this case "test.jsf" in jsftemplating?
>>>>>
>>>>> thanks
>>>>> -Karam