Wrinting into html
Hello guys,
I want to make a content management system. But to keep everything fast, I want to alter html pages automatically from my JSP pages...
For example:
I add a text in the admin to the database. Then I want to add this text to the index.html between a custom TAG in that HTML, placed before (<!--START TEXT--> & <!--END TEXT-->).
Has somebody ever tried something like this ? Is this possible with JSP ?
Regards,
Kristof
[488 byte] By [
brocky] at [2007-9-27 16:58:25]

I can't understand why it's impossible...
It's very simple:
1) Read index.html, using java.io.*
2) Find <!--start text--> and <!--end text--> tags
3) Insert whatever you want between them
4) Flush
5) Enjoy
Other way will be using XML like approach. Be sure that index.html
is XML compliant (XHTML), read it and using SAX of DOM, whatever
you prefer and add your content between these tags.
Paul
The best way to do this is XML reader as discussed in the previous column. But for this the content should be of XHTML format. If the content is not XHTML format, don't worry, you can write a simple API-convertor to do this.
ITkid at 2007-7-6 1:15:57 >
