Ben Pezzei wrote: > Hi again, > > >>Ben, if you tell us what the end goal is, maybe we can suggest an >>alternative solution. > > > sure, first time i tried to keep it simple, so i left out the idea > behind ;) > > ok, I am working on some CMS, where a user can write an article. > This article is saved in a db. The author is also able to > set some links within this article. therefor he has to use > the tag <a:link target="someurl">here</a:link> in the text. > > so this article is nothing more than a String, which could > contain a tag. > > to display an article i use another tag <article:display id="someid"/>. > in the jsp. > > So basically in the article tag class i connect to the db, read > out the text-field and print it out. And heres the problem: > if this String (from the db) contains a tag how can i process > this tag within another tag? Using another custom-tag to accomplish > this seems a bit strange, because the functionality is already here > (although the servlet-engine does this) > > So the perfect way would be: give the String, which contains the > tag, to some method, parse it and return the altered text with > the correct link. how can i give this String to the corresponding > link-tag-class? if possible;) > > i hope it's a bit clearer now. > > and again, any help or hint would be great
I would suggest that you instead allow regular <a> elements in the text. If the URL must be processed somehow (e.g. expanded with a some special prefix, URL rewritten, etc. your <article:display> can simply parse out the <a> elements, process them and add the result to the output stream. This way the author can use an HTML element she is familiar with, no need to learn a new one. If the processing is complex, and if you want to invoke it in other places using the <a:link> action, put it in a separate class that you can use from both the <a:link> and the <article:display> tag handlers. Or did I miss something? Hans -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com JavaServer Pages http://TheJSPBook.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>