Reputation: 315
Hey folks, ok so this is my problem, I need to display HTML code in a jsp, which wouldn't be a problem, except a requirement for this project is that we place all the code in a public class file and have seperate methods for each chunk(header, sidebar footer, etc). Now here's where i'm confused:
"Your method should take the PrintWriter as a parameter to print out each line of HTML, and should have a return type of void"
What does that mean? How do I pass the PrintWriter into a method? Does this make sense to anyone?
Upvotes: 0
Views: 418
Reputation: 199215
"Your method should take the PrintWriter as a parameter to print out each line of HTML, and should have a return type of void"
That's pretty clear to me:
/* return type void -->*/ void yourMethodNameHere( PrintWriter parameter ) { /*<-- Pw as parameter*/
}
What does that mean?
Exactly that
How do I pass the PrintWriter into a method?
Ah, this is the interesting part. I'll give you a hint, check it out: http://www.google.com/search?&q=jsp+predefined+variables
Does this make sense to anyone?
Pretty much
Upvotes: 1
Reputation: 5302
It means that your method (that you will have to name yourself) will have one argument of type PrintWriter. In your method you should then call that variable's print method.
I am deliberately vague here, because you should do some of your homework yourself :)
Upvotes: 2
Reputation: 1500165
Your question is far from clear, but it sounds like you need to write code like this:
public void writeHeader(PrintWriter out)
{
...
}
public void writeSidebar(PrintWriter out)
{
...
}
public void writeFooter(PrintWriter out)
{
...
}
Upvotes: 2