Refactoring old tags: Tag Files (re: mother of a refactor)

V

VisionSet

We have a poor tag solution for our content management system that
relies on html coments used as tags in a plain html file.
This file is parsed out by a *jsp* page line by line as a fileStream.
Each tag is replaced by laborious String library funcionality indexOf
etc.
So you get horrible scriplet syntax where content is all quoted in
String declarations.
Obviously content such as this is best presented as free format html or
jsp.
My idea towards improvement is to use tag libraries - I think called
Tag Files? I can replace the old html comment tags with jsp custom
tags to specifically solve the ugly parseing we have at the moment.
Does this sound like the right approach as one step in my Mother of a
Refactor?
 
A

Andy Dingley

VisionSet said:
We have a poor tag solution for our content management system that
relies on html coments used as tags in a plain html file.
My idea towards improvement is to use tag libraries

Sounds good.
Does this sound like the right approach as one step in my Mother of a
Refactor?

One step - certainly very good.

However the first step in _refactoring_ is always the same. Set up an
automated test environment so that you can verify your "refactorings"
aren't changing anything. If you don't do this first, then you might be
"reworking" the code, but you aren't refactoring it in a controlled
manner.
 
A

Andrea Desole

VisionSet said:
We have a poor tag solution for our content management system that
relies on html coments used as tags in a plain html file.
This file is parsed out by a *jsp* page line by line as a fileStream.
Each tag is replaced by laborious String library funcionality indexOf
etc.
So you get horrible scriplet syntax where content is all quoted in
String declarations.
Obviously content such as this is best presented as free format html or
jsp.
My idea towards improvement is to use tag libraries - I think called
Tag Files? I can replace the old html comment tags with jsp custom
tags to specifically solve the ugly parseing we have at the moment.
Does this sound like the right approach as one step in my Mother of a
Refactor?

It's not completely clear, but yes, I would say so.
What you should also consider is that maybe it's possible to do
everything just with the regular tags. With JSTL it's also possible to
do an XSLT transform (although I have never tried it). For what I
understand your situation is, maybe it's a good option
 
V

VisionSet

Andy said:
Sounds good.


One step - certainly very good.

However the first step in _refactoring_ is always the same. Set up an
automated test environment so that you can verify your "refactorings"
aren't changing anything. If you don't do this first, then you might be
"reworking" the code, but you aren't refactoring it in a controlled
manner.

Yes we are doing that, but that is a known.
I wnat to be thinking a step ahead.

The template file we have at present is not a jsp. It is just a source
of parseing.
A JSP parses this template file. Now I want to replace 1 tag at a
time. So that the file continues to work on the old system, being
parsed but also acts as a JSP page in that the new custom tags are
handled by the container. How can I do that?

TIA,
Mike W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top