# ShowImage.jsp Sample

This topic inludes the source code for the ShowImage.jsp Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/handlingData/binaryFlow/

## Sample Source Code

`01 <%@ page language="java" contentType="image/gif"%> 02 <%@ page import="java.sql.Blob"%> 03 <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%> 04 <%@ taglib uri="netui-tags-html.tld" prefix="netui"%> 05 <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%> 06 <netui-data:declareControl type="handlingData.binaryFlow.docContentDB" controlId="test"/> 07 <!-- 08 Get the 'photoid' parameter from the URL and call the getPHOTO() method on the docContentDB.jcx 09 database control. 10 --> 11 <netui-data:callControl controlId="test" method="getPHOTO" resultId="blob"> 12 <netui-data:methodParameter type="int" value="{url.photoid}" /> 13 </netui-data:callControl> 14 <!-- 15 The database control returns the image data as a java.sql.Blob object. 16 Convert the Blob into a byte[] and place the byte[] on the request object. 17 --> 18 <% 19 Blob blob = (Blob) pageContext.getAttribute("blob"); 20 byte[] rgb = blob.getBytes(1, (int) blob.length()); 21 request.setAttribute("byArr", rgb); 22 %> 23 <!-- 24 The image data is now on the request object. 25 Forward the user to the showImage servlet. 26 That servlet will process and display the image data contained on the request object. 27 28 Note: ignore the compiler warning below (indicated by green underscoring). 29 Workshop issues the warning because it cannot find the servlet class named "/showImage". 30 The reason it cannot find the class is because "/showImage" is a mapping-defined name 31 for the class "handlingData.binaryFlow.servlets.ShowImageServlet" and Workshop is 32 not aware of mapping-defined names for classes. The mapping-defined name is specified in 33 WEB-INF/web.xml. 34 --> 35 <jsp:forward page="/showImage" />`