Java and HTML dont go together.
In the current project which I am working is an interesting one. We have one gigantic jsp page with close to 100 fields on a average. Out of the 100 fields, 60 of them are constant fields and rest being driven by 6 parameters. And each parameter has 4 possibilities so basically 4*(6!) combination.
So, we started out with creating components that can reused when the combination repeats. For the first couple of releases we had great success, we shrunk the development time; the page that used to take 3 days now took only 1 day or less. We implemented around 100 combination quickly.
After 3 or 4th release now we had a new business requirement that wanted a change... Oops... the business said that these never changes.... (Lesson learned:What ever we develop always changes.. Always have provision for change). Now we had to revisit the components which were assumed to be common are not common any more now.
We started the second iteration. this time around we pushed all the sturts controls in the jsp. We came up with only one taglibrary this time. We separated the Java Code and HTML. Each html component for example Telephone Number component (A label and 3 text field) is wrapped by this custom tag-library. The custom tag's main task is determine whether to doBody or skipBody. The custom tag now uses a Util class's static method which returns a boolean value. Based on the boolean value doBody or skipBody is invoked.
This way we have one generic solution, Adding or removing an existing control in the page is just a change in the xml file. So this enable to do maximum re-use of components and easy to maintain.
In the current project which I am working is an interesting one. We have one gigantic jsp page with close to 100 fields on a average. Out of the 100 fields, 60 of them are constant fields and rest being driven by 6 parameters. And each parameter has 4 possibilities so basically 4*(6!) combination.
So, we started out with creating components that can reused when the combination repeats. For the first couple of releases we had great success, we shrunk the development time; the page that used to take 3 days now took only 1 day or less. We implemented around 100 combination quickly.
After 3 or 4th release now we had a new business requirement that wanted a change... Oops... the business said that these never changes.... (Lesson learned:What ever we develop always changes.. Always have provision for change). Now we had to revisit the components which were assumed to be common are not common any more now.
We started the second iteration. this time around we pushed all the sturts controls in the jsp. We came up with only one taglibrary this time. We separated the Java Code and HTML. Each html component for example Telephone Number component (A label and 3 text field) is wrapped by this custom tag-library. The custom tag's main task is determine whether to doBody or skipBody. The custom tag now uses a Util class's static method which returns a boolean value. Based on the boolean value doBody or skipBody is invoked.
This way we have one generic solution, Adding or removing an existing control in the page is just a change in the xml file. So this enable to do maximum re-use of components and easy to maintain.
Labels: Java and HTML dont go together.


0 Comments:
Post a Comment
<< Home