File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

On the brink of madness

 
David Mason
Ranch Hand
Posts: 56
Android Chrome Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
John Hembree
hired gun
Ranch Hand
Posts: 250
MS IE Oracle Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Mason
Ranch Hand
Posts: 56
Android Chrome Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
David Mason
Ranch Hand
Posts: 56
Android Chrome Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ta Barry,
Ain't it amazing how difficult it is to see the path, when your nose is up against a tree
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic