This application illustrates how to retrieve image and data from MySQL table using NetBeans IDE.
In this application we create a jsp page to display image. In this JSP page we are using <h:graphicImage> tag to access the servlet, here we are uses servlet but as u wish u can access a jsp page also. To create the project in the NetBeans IDE select File > click on "Create Project" then a New Project window will be appear, select Web from Categories section and select Web Application from Projects section. Click Next.
Put Project Name and click Next.
Choose JavaServer Faces and click Finish.
To create the jsp file right click on Web Pages select New and click JSP as below:
Here is the Source Code of data.jsp
To create the package right click on Source Package and select New > Java Package..
The following window will appear then put package name and click Finish.
To create the java class right click on newly created package and select New > Java Class
Put the Class Name and click Finish.
Source Code of DisplayImage.java
Create Bean class to set and get the table column as below the source code of TableBean.java
Servlet Mapping in web.xml
Source Code of faces-config.xml
The Output shown on the Browser as below:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.