File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes maintain/organize jsp links w/o having to edit all the pages linking to Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "maintain/organize jsp links w/o having to edit all the pages linking to" Watch "maintain/organize jsp links w/o having to edit all the pages linking to" New topic
Author

maintain/organize jsp links w/o having to edit all the pages linking to

Tom Kata
Greenhorn

Joined: Dec 12, 2002
Posts: 7
I am looking for methods (or even products) that I can use to maintain the organization of the html/jsp pages I link in
<%@ include file="somefile.jsp" %>
directive such that if the name or location of "somefile.jsp" changes, all I'd need to do is change it in some file-maintenance file. For example, I was thinking of creating an xml file where tags would be given a generic name that references back to different files (eg. <header>, <footer>, <content> ; then if I need to change the location of the file, all I need to do is change the value of the appropriate xml tag to the new filename or location, and then the jsp container (I use tomcat4) would be able to compile the "include file" directive to the new one while preventing unnecessary, time-consuming edits in the jsp page(s).
I would extremely appreciate any suggestion on methods, implementations, or even products that would do this kind of file maintenance, as I have searched all over the web and have yet to come close to anything that would do this.
Thanks so much in advance.
Jeya Balaji
Ranch Hand

Joined: Jan 02, 2003
Posts: 40
Hi Tom,
I am also looking for a good way of hiding the details.
Struts kind of framework should help us. Yet to find time to try it out; probably for the next project I will use it.
Now I am using the following method :
<a href='controller?page=home'>Home</a>
ie, using a controller servlet which will accept page as a parameter and forward to that page.
The controller servlet can read a property file to map the page name with the page url.
I am working out to something more simple, like :
defining <servlet-mapping> in web.xml such a way that *.html (or *.jsp *.do) will be passed to controller servlet. Then controller can identify the requested page and transfer control to that page.
In this setup, the link will be
<a href='home.html'>Home</a>
Here even the 'controller' will be removed. Have to see if this idea will work.
Regards,
Balaji


Regards,<br />Balaji
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
We did use xml files to configure stuff like links on jsps and such but a better way of doing things is using struts and tiles, which we are now doing.


No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
 
 
subject: maintain/organize jsp links w/o having to edit all the pages linking to
 
Threads others viewed
could servlet include the jsp,html files???
problem with both jsp: include and %@include tags
doubts realted to include directive
page directive
jstl problem
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com