Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i use Beans?

 
Shahid Ali Naz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
con some body tell me about using beans like how to create beans compile and use for
example my task is implement a bean which give me the length of String
code is
public int len(String str)
{
return str.length();
}
how can i use on jsp or java programmes can u write bean on simple editor like java files and how can i complie and how i call from my main application
bye
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, your class does not look like an information bean with its method len. It should be getLen(String s) or getLength(String s)
Yes you can use a simple editor to write a Java bean. A Java bean is nothing more than a class with methods that follow some kind of convention in naming.
I am assuming that you mean Java beans in the server-side context and not in the visual context which requires considerably more programming.
Information on how to write beans is freely available from Sun at:
http://java.sun.com/docs/books/tutorial/javabeans/index.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic