Can you show how you are including resource.inc? Do you have the
jsftemplating DEBUG flag on or off?
You shouldn't have to restart the server to see any changes (assuming
you have the DEBUG flag on). I haven't restarted my server since your
first email and I have changed the page several times to perform tests
to ensure things are working properly.
I just added this to the top of my test file:
#include i.inc
I moved the content of the redirect to that file and it behaved correct
(w/o any restart / redeploy). I made changes to the i.inc file and they
also appeared correctly.
One thought... perhaps you have a space before the "#". The "#include"
is required to be at the beginning of the line to be processed.
Otherwise, it will be interpreted as a comment.
Ken
Karam Singh Badesha wrote:
> Currently my initPage code is in a "resource.inc" file that I include
> in all my pages. I made some other changes to this file and it seems
> like they are not taking effect (even though I restarted the server
> and redeployed the war file). So then I created a new jsf file with
> just exact code from resource.inc file and it works fine. So I think
> the problem is really with cache or resource.inc file not getting the
> updates that I have made. Any suggestions why this is happening?
>
> thanks
> Karam
>
> Ken Paulsen wrote:
>>
>> Hi Karam,
>>
>> I did the test as you described below and it worked fine. However,
>> what I *didn't* do was enable security... so here's what may be
>> happening. You are visiting a page that is protected by a security
>> constraint in your web application and it is redirecting to your
>> login.jsf page. I don't think the FacesServlet is even being invoked
>> for the page you attempted to visit, let alone the initPage(). You
>> can try to execute a "println()" in the initPage to see if you can
>> get it to execute to test this.
>>
>> How to get around this problem. Disable security (I don't think
>> that's the way you want to go). Find a way to get the original
>> request URI information from w/i the login.jsf page (not sure if this
>> is available or not... although I think it is). If the page IS
>> executing before the redirect, try storing it in session instead of
>> as a QUERY_STRING parameter (I don't think this is an option, though,
>> b/c I don't think the FacesServlet let alone the initPage is
>> executing). Last, try emailing the GF dev alias
>> (dev_at_glassfish.dev.java.net) and see if anyone (like Jan Luehe) has a
>> better suggestion.
>>
>> Ken
>>
>> 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