Really I am. And it's Servlets-4b that's doing it. I appear to need to have constant strings of html with variable bits in them. You see I really am mad. Initially each servlet had it's own string of html and much was the same between servlets, eg .html..head..title.Assignment 4.4b - Add a Video ./title../head. ... It was suggested that I try to share html fragments as widely as possible. So I did. I extracted the common stuff and put it somewhere common; there were short strings, and very short strings. I created methods to access the common bits and insert the variable stuff. Now it is suggested that I have constant strings and just print them. But I don't see how to insert the variable stuff into the constant strings. Please help. I think I'm going mad. I'm certainly , & . And I'm getting to be certifiably
First the disclaimer, I'm normally way off when it comes to the nitpicker's choice of really cool features to implement. I would think that a constant can't have a variable in it, that would make it dynamic, so break your strings up around the variable. If the title is dynamic, have a constant title start and a constant title end, then wrap your title variable with these new constants. Do this all the way thru your code and send it in, which per my disclaimer means you'll be getting it back to redo it.
Thanks John. That's what I tried to do - the "doHeader" method takes the variable parameter and wraps the constant "headerHead" and "headerTail" strings around it. And yes, it did come back for rework; I've got too many doXXX routines
I think you have to print a little "constant" stuff, print a bit of "variable" stuff, then a bit of "constant" stuff, and so on... (I didn't do it that way at first of course. I was also lacking in the mutant parrots area)