This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Change file name ending for JSP pages

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
what's the most J2EE-conformant way to have other file name endings than .jsp treated as java server page by the servlet container?
I'd prefer if the used technology (JSP, ASP, ...) is kept hidden from the user (he just sees .html).
Regards,
Andreas
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the ../conf/web.xml file where the jsp servlet is mapped

Bill
 
Marshal
Posts: 67424
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be ill-advised to map the JSP's to some extension that is known to be 'static' (such as .html).
Trust the voice of experience! We did this at one of my former jobs and it caused no end of problems. Turns out there are 'helpful' servers out there (AOL servers included) that will cache html pages. It resulted in clients being sent pages full of data from other clients due to this 'helpful' caching.
Proceed with caution.
bear
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to add to Bill's answer, you can also do with this on a JSP by JSP basis by using the servlet-mapping elements in your web.xml file.
Alternatively, and something that I've done recently, you can use a filter to transform incoming requests to xyz.html to a specific JSP. If you take a look at my website and click on one of the links in the calendar at the top-right, you'll notice that all these links all reference HTML pages. All of these pages are in fact dynamically generated, and the filter intercepts the requests for xyz.html and redirects them to servlets and JSPs. Again, just another solution, depending on what you want to do.
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear, isn't that an indication that the modify dates on the responses are not being correctly generated?
 
Bear Bibeault
Marshal
Posts: 67424
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know all the details of the problem we were having since it was being caused off-site somewhere between our servers and the client systems. Nothing we changed re caching control seemed to help. We finally changed the 'faked' file extension from .html to .page and all was well. Very wierd, and lotsa hair (that I don't have in the first place) was lost over that one!
bear
 
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic