aspose file tools*
The moose likes JSP and the fly likes classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "classes" Watch "classes" New topic
Author

classes

Relu Ovidiu
Greenhorn

Joined: Mar 18, 2004
Posts: 12
I have a class...and i want, in one of the class's method, to print a text on the screen..but a recive an error( i'm using out.println)...how can i do that?Thnx!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Welcome to the Ranch James.
but a recive an error( i'm using out.println)...how can i do that?

You can begin by giving us more information. What is the line of code that is causing the error, and what is the exact wording and nature of the error.
Otherwise, it's just guesswork.
[ March 18, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Relu Ovidiu
Greenhorn

Joined: Mar 18, 2004
Posts: 12
How can i print a text on the screen(web page) using a class's method? (it doesnt't mater what class .. and what method...) Can u give me an example with a class and a method that print a text? (jsp/servlet) ....Thnx!
eammon bannon
Ranch Hand

Joined: Mar 16, 2004
Posts: 140
Post your code. Post your error. Then maybe someone might be able to spot what's wrong.
Gowrishankar Mudaliar
Ranch Hand

Joined: Oct 20, 2001
Posts: 39
Try passing the response object to the class and then do response.getWriter().
This should give you a printwriter reference. You can use this to write to the web page.
To be more precise, you have to post your code.
Winston Smith
Ranch Hand

Joined: Jun 06, 2003
Posts: 136
You can call a method such as this from your JSP:

On your JSP page, you would have something like:


for (int i = today; i < endOfTime; i++) { code(); }
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
I am not sure whether i've understood ur question correctly but leme try .
1) make a class wth a function . e.g:
public class test
{
public String getStr()
{
String str = new String();
str = "JAMES";
return str;
}
}
2) call this class in the jsp and using the class object, call this function. E.g :
Test t = new Test();
String str = t.getStr();
out.println(str);
3) run the jsp file and see the output . If it doesn't print "JAMES" then there is something wrong in your calling the class file.
Hope this helps


Raghav.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: classes