• Post Reply Bookmark Topic Watch Topic
  • New Topic

Architectural Question

 
Jochen Maes
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm designing a dynamic website (duh :-]), and i wan't to be able to give my users their own layout. (css and own images etc) that is no problem.
works great thx to taglibs and struts... (faaster then i even thought).
But i have one problem.
I want to give them the possibility to have custom pages (content changes etc) they can put them in their folder and from then of the site should load that page. But when removing the site should fall back on the default page. How can i do that without having to wait for a timeout on the page.
Is there a possibility to check if the page exists ifso --> load it, otherwise load the default. But it shouldn't be to slow :-]

thanks for you suggestions...
maesj
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It becomes pretty easy if you use a servlet controller to get to the page. The servlet can easily check if the file representing the page exists (hint: servletContext.getRealPath()) without having to wait for any timeouts, and then either forward to the page (if the check went ok) or to the 'default' page otherwise.
hth,
bear
 
Jochen Maes
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear,

The getRealPath(String path) just returns the complete path... if the file is there or not.
I really need to check if the file is there...
If not i need to know it as quickely as possible...
thx..
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't you wrap the "path" in a File object and call the File.exists() method.
Craig.
 
Jochen Maes
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cj jack,
yes this is how i do it right know but i find it very unclean to do that for each image and url..
i was hoping there is a cleaner way of doing but then again this isn't on jsp/servlet level anymore but on serverlevel...
thx for the input
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!