• Post Reply Bookmark Topic Watch Topic
  • New Topic

freeform style output in JSP Functions?  RSS feed

 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any way to do the "%> .... <%" style output from the inside of a JSP function, or are you forced to use println() from the response's writer?

Thanks in advance,
Yuriy Zilbergleyt
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I found a way to do it using method local classes, but while it works on Tomcat, I'm sure not whether or not the J2EE specs for JSP compilation guarantee that it will work on all web containers. Plus its a bit ugly...


[ March 04, 2005: Message edited by: Yuriy Zilbergleyt ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not at all a good idea and strongly discouraged.
By the way, what you are trying to do?
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it not a good idea, at least any more than normal scriptlets are not good ideas? Is it just the maintenance hassle for when someone unfamiliar with the code tries to figure out what's going on?

I was just looking for a way to do jsp type output from a function for cases where similar HTML code might appear in multiple places of the page. The particular instance I investigated was building collapsible trees (click on a branch and it expands, click again and it collapses.) A call to one function generates the HTML to start a branch, and another call ends the most recent branch that's open. While I realize that a custom tag library might seem perfect for this, those just seem such a pain to write, and you have to use println() for them as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!