users@glassfish.java.net

Re: JSTL Questions

From: ITVGuy2000 <hhartley_at_pobox.com>
Date: Fri, 10 Aug 2007 22:12:15 -0700 (PDT)

The solution is to add the following to the default-web.xml:
  <servlet-mapping>
     <servlet-name>jsp</servlet-name>
     <url-pattern>*.jspf</url-pattern>
  </servlet-mapping>

Since NetBeans and Apache seem to think that JSPF is a standard file
extension meaning (Java Server Page Fragment), wouldn't it make sense to
have the lines above in the default-web.xml by default?

ITVGuy2000


ITVGuy2000 wrote:
>
>
> ITVGuy2000 wrote:
>>
>>
>> Jan.Luehe wrote:
>>>
>>> ITVGuy2000 wrote:
>>>
>>>>Well, I don't have any spec issues, or issues with the glassfish
>>>>implementation, its more a how-to kind of question. I am going to post
it
>>>>here, since this seems as good a place as any.
>>>>
>>>>On my website, I have hundreds of pages all with the same basic form:
>>>>
>>>><%_at_page contentType="text/html"%>
>>>><%_at_page pageEncoding="UTF-8"%>
>>>><%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
>>>>
>>>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>>>> "http://www.w3.org/TR/html4/loose.dtd">
>>>>
>>>><html lang="en"/>
>>>> <head>
>>>> <meta http-equiv="content-type" content="text/html;
>>>>charset=iso-8859-1"/>
>>>> <link rel="stylesheet" type="text/css"
>>>>href="/design/css/reset.css"/>
>>>> <link rel="stylesheet" type="text/css"
>>>>href="/design/css/mystyles.css"/>
>>>> <title>My Test</title>
>>>> </head>
>>>> <body>
>>>> <div id="container">
>>>> <c:import url="/jspf/header.jspf" context="/design"/>
>>>> <c:import url="/jspf/mainnav.jspf" context="/design"/>
>>>> <c:import url="/jspf/menu-messing.jspf" context="/design"/>
>>>> <div id="contents">
>>>> <h1>This is my test</h1>
>>>> </div>
>>>> <c:import url="/jspf/footer.jspf" context="/design"/>
>>>> </div>
>>>> </body>
>>>></html>
>>>>
>>>>I want to start to do some usage reporting on my website. I would like
to do
>>>>this by adding some code in the imported header.jspf, rather than each
and
>>>>every page.
>>>>
>>>>My question is this:
>>>>Is there a way for an imported JSP code fragment from a foreign context
to
>>>>"know" about the request of the importing page?
>>>>
>>>>
>>>
>>> <c:import> is implemented as a RequestDispatcher.include(), which
>>> means that the included resource can tell that is being included
>>> by checking for the presence of any javax.servlet.include.* attributes
>>> in the request (see SRV.8.3.1), irrespective of whether the resource
>>> was included from a foreign or its own context.
>>>
>>> Does this answer your question?
>>>
>>> Jan
>>>
>>
>> Well, I guess it should, but I am not sure what is wrong with my app
>> then.
>>
>> If I have a header.jspf of:
>> <div id="header">
>> <h1>hhartley.com</h1>
>> /design/css/hah_logo_small.gif
>> <%=request.getRequestURI()%>
>> </div>
>> Shouldn't I see the URI info in the page above I described earlier?
>>
>> What I see when I run the page is instead:
>> <%=request.getRequestURI()%>
>> Not the URI showing up in the header of the page.
>>
>> I feel like I am getting something fundamental wrong. Any help?
>>
>> ITVGuy2000
>>
>
> It seems if I rename the imported files from the jspf extension to jsp,
> then things work as expected. Is there some problem with the JSP compiler
> not recognizing jspf extensions?
>

-- 
View this message in context: http://www.nabble.com/JSTL-Questions-tf4241205.html#a12102732
Sent from the java.net - glassfish users mailing list archive at Nabble.com.