• Post Reply Bookmark Topic Watch Topic
  • New Topic

Change file name ending for JSP pages  RSS feed

 
Andreas Schildbach
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
 
William Brogden
Author and all-around good cowpoke
Rancher
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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
 
Simon Brown
sharp shooter, and author
Ranch Hand
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.
 
Ron Newman
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
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!