Solved

Java Bean

Posted on 2003-10-21
7
261 Views
Last Modified: 2010-04-01
Anyone hav examples of java bean. Or any source for Java Bean. Can any 1 tell me more about Java Bean Bcoz i am still new in it.
0
Comment
Question by:UnluckyXIII
  • 2
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
applekanna earned 60 total points
ID: 9596522
Java bean in 2 lines.

it is a normal class with get and set methods and other public methods and  does have intializations in it constructor and usually access the backend db.

eg bean to set username and pwd in a dbd

public class LoginBean{
//instance variables
private String login;
private String pwd;

//get method
public String getLogin()
{ return login; }
//set method
public void setLogin(String newVal)
{ this.login = newVal }

//other mthods connecting to db etc
public String getPwd()
{
  //connect to db and retireve pwd
  return pwd;
}


}//end class

does this help?
0
 

Author Comment

by:UnluckyXIII
ID: 9596636
wht code is use to retrieve a file from database, any example?  Need help, example retrieving files from database containing gif,jpg and midi files.
0
 

Author Comment

by:UnluckyXIII
ID: 9596640
wht code is use to retrieve a file from database, any example?  Need help, example retrieving files from database containing gif,jpg and midi files.
0
 
LVL 3

Expert Comment

by:applekanna
ID: 9596705
If u store an image as a BLOBs in my database, then use getBinaryStream to retrieve the value

see this http://www.jguru.com/faq/view.jsp?EID=159

this thread has code
http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_20602681.html


code snippet to upload into db
http://forum.java.sun.com/thread.jsp?thread=315523&forum=45&message=1993302

an easy way would be store all the images in a folder and store their path in the db and link them form your page , this is the best way to do it instead of storing images in the db.

for eg store http://www.yoursire.com/images/bulb.gif in the db and

in the page just refer to it
<img src = "http://www.yoursire.com/images/bulb.gif">

does it help
Cheers!
0
 

Expert Comment

by:chainreaction
ID: 9605310
my dear friend... trust me, you will not figure out what is the Javabean in here... if you do, you will have another question such as how to connect JSp to JavaBean... or how to put the javabean with your JSP and so on.

Get a book, the JSP for dummy is the best for beginner.. because all beginner are dummy, including me once upon a time.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question