Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using Writer in JspFragment invoke() method

 
Alan Hermin
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers........
I am reading HFSJ....at page 512,regarding of JspFragment class which has invoke() method..This method has a java.io.Writer as argument,,the book say that there is a way to access the contents of the body using Writer...
i tried to write this inside doTag():


I Opened the file myTextFile.txt but there is no output...can you help me
regrds
[ July 30, 2006: Message edited by: Ala'a Hendi ]
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ala'a

I checked with a sample code. Sending fileWriter object to invoke() is working fine ..So now the problem could be at two places:

== that you do not have any content defined to write to a file...
or body is empty?

Check again...

Regards,
Shivani.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So now the problem could be at two places:

== that you do not have any content defined to write to a file...
or body is empty?
...or that you didn't flush the output stream after the JspFragment invoke()? If you're not going to use it again, far better to close it anyway with fileWriter.close().
 
Alan Hermin
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnx to all.........the problem was : flushing the stream before the invoke method,,so the soluation make the flush after invoke() method.....


regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic