Home Answers Viewqa JSP-Servlet forwarding request to a jsp from a filter and displaying image in that jsp

 
 


suresh anugandula
forwarding request to a jsp from a filter and displaying image in that jsp
1 Answer(s)      a year and 5 months ago
Posted in : JSP-Servlet

Hi all,

I have placed all the jsps in pages folder and images in images folder. in pages folder i placed login.jsp and in images folder i placed tatalogo3.jpg. following is login.jsp

  • login.jsp

And i am forwarding request to this login.jsp from a filter like this

request.getRequestDispatcher("login.jsp").forward(request, response);

Above line is forwarding the request to login.jsp correctly, but in login.jsp the image is not displaying. Can you help me in resolving this problem.

Thanks & Regards, Suresh

View Answers

December 7, 2011 at 1:03 PM


Jsp Display Image

<%@ page import="java.io.*" %>
<%@page contentType="image/gif" %><%
    OutputStream o = response.getOutputStream();
    InputStream is = new FileInputStream(new File("C:/images/image.gif"));
    byte[] buf = new byte[32 * 1024]; 
    int nRead = 0;
    while( (nRead=is.read(buf)) != -1 ) {
        o.write(buf, 0, nRead);
    }
    o.flush();
    o.close();
    return; 
%>









Related Pages:
forwarding request to a jsp from a filter and displaying image in that jsp
forwarding request to a jsp from a filter and displaying image in that jsp ... And i am forwarding request to this login.jsp from a filter like this request.getRequestDispatcher("login.jsp
JSP forwarding
JSP forwarding  What is JSP forwarding?   Hi, You can use the JSP forward tag for jsp forwarding. This will help you forward your request to some other page on the same server. Here is the code for jsp forwarding
forwarding request to a jsp when user clicks on back button in ie
forwarding request to a jsp when user clicks on back button in ie  Hi all, I have developed a web based application. After user log out... we forward request to a jsp page whenever user clicks on back button
Displaying image using jsp and spring.
Displaying image using jsp and spring.  how to display an image stored in WEB-INF/images folder on the browser using jsp and spring
Displaying image when clicked on URL in jsp - JSP-Servlet
in displaying the image from the folder. Regards, Anish...Displaying image when clicked on URL in jsp  Hi, I am using... For Screenshot : abc.jpg here abc.jpg is a url and when clicked would show me an image
Displaying Rows - JSP-Servlet
Displaying Rows  Hi, I need your support on how to display data from... extends HttpServlet{ public void doGet(HttpServletRequest request... = stmt.executeQuery("SELECT name, position,discription FROM dispalyinfo
How JSP Forwards a request
; The <jsp:forward>  forwards the request information from one resource to the other, for example, one jsp file to other. To forward a request from one... How JSP Forwards a request     
displaying data retrieved from a database in a jsp page
displaying data retrieved from a database in a jsp page  the page... processRequest(HttpServletRequest request, HttpServletResponse response) throws... sql = "select billid, customerid, billdate, status from customerbills where
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want.../WebSevices/19592-retriving-data-from-sql-server-using-jsp-code-and-placing-them... Request") return } var url= "emp.jsp"; url += "?val1=" +str1+"&&val2="+str2
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want.../WebSevices/19592-retriving-data-from-sql-server-using-jsp-code-and-placing-them... Request") return } var url= "emp.jsp"; url += "?val1=" +str1+"&&val2="+str2
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want.../WebSevices/19592-retriving-data-from-sql-server-using-jsp-code-and-placing-them... Request") return } var url= "emp.jsp"; url += "?val1=" +str1+"&&val2="+str2
ServletFileUpload request getInputStream - JSP-Servlet
ServletFileUpload request getInputStream  Hi All, I want multiple... carried whichever files(may be image files or song files, or text) and wherever location(may be c:\.. or d:\..) from client browser to servlet file. Here is my
Displaying Date in jsp - JDBC
Displaying Date in jsp  I want to insert Date of birth of a person in a database.i am getting input value from HTML and i use jsp application to interact with database.My JSP code for inserting Date is below: String dateStr
Form with a search filter in spring mvc?
Form with a search filter in spring mvc?  Hi I am new to Spring MVC, I have created a spring project which is displaying the list from database into my jsp page, Now in the same jsp page at the right hand corner I have a search
Form with a search filter in spring mvc?
Form with a search filter in spring mvc?  Hi I am new to Spring MVC, I have created a spring project which is displaying the list from database into my jsp page, Now in the same jsp page at the right hand corner I have a search
JSP Request Object
JSP Request Object  JSP Request Object ?   request object in JSP is used to get the values that the client passes to the web server during an HTTP request. The request object is used to take the value from the client?s
displaying both image and records problem in jsp and servlet - JSP-Servlet
displaying both image and records problem in jsp and servlet  hello, Thanks for your reply on the question i asked the other time. It worked perfectly, but it's still not what i want. What i want is that, i want
displaying data
displaying data   how to display data from database on jsp using struts2
Servlet Filter
of a request and response from server. Generally it does not create response... in servlet doFilter() method of Filter interface which is passed request...;/*</url-pattern> </filter-mapping> Following image describes
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I need to retrieve the records from the database for every 7 seconds and display...;%@page import="com.tbss.RtChannels"%><%@ taglib uri="http://java.sun.com/jsp
Problem displaying resultset in jsp(no frameworks used) - JSP-Servlet
Problem displaying resultset in jsp(no frameworks used)  Problem Domain: Within my MVC application, 1)from the model class, I am getting all my... area: a) How to display the records within JSP from request>arraylist>
JSP Request Dispatcher
page. Understand with Example The Tutorial illustrate an example from 'JSP Request... JSP Request Dispatcher   ... the RequestDispatcher class to transfer the current request to another jsp page. You can
Data displaying with limited records in jsp
Data displaying with limited records in jsp  How to display table with limited 10 records , after clicking next button another 10 records from database upto last record please help me
Delete image from folder - JSP-Servlet
Delete image from folder  Hi Thanks Rajnikant to given me reply i am not storing my image in db just userid comming from db means my... image from ur server not from local copy. DeleteServlet.java
Uploading an image - JSP-Servlet
; //to get the content type information from JSP Request Header String...Uploading an image  I am doing a jsp project. In this uploading an image is a part. For that i had done a coding for uploading
how to add Arraylist filter for a jsp page showing results from a servlet
how to add Arraylist filter for a jsp page showing results from a servlet  hello sir/mam, in my project i have an arraylist showing results in a jsp...; and from that i want result filtered as this the table which is filter
how to upload image from jsp to mssql
how to upload image from jsp to mssql  hi there!!, i'm using jsp... database. hope u can help in my database: i have imagetbl that contain image column(to store the image) as varbinary and fileimage(to store the directory
how to upload image from jsp to mssql
how to upload image from jsp to mssql  hi there!!, i'm using jsp... database. hope u can help in my database: i have imagetbl that contain image column(to store the image) as varbinary and fileimage(to store the directory
filter
filter  What is filter? Can filter be used as request or response
Displaying Constant values from Interface in JSP - JSP-Servlet
Displaying Constant values from Interface in JSP  Hi, ******Sorry... need to display suitable fields in my jsp but this should be done upon suitable...="COMP100"; // and so on } IN HOME JSP ****** home.jsp **** Currently
REQUEST - Java Beginners
gettting data from the database from the javaBeans to jsp by vectors... but i am unable to displaying them in jsp 15 records per page... i have to display... to 30th record.. like that so on... i need to implement in jsp
jfreechart displaying chart from access database
jfreechart displaying chart from access database  I have these 2 codes. array.java----in which i retrieve the values from the database . import.... * @param request servlet request * @param response servlet response
JSP - Problem of displaying result at webpage
JSP - Problem of displaying result at webpage  Can anyone please help to solve my problem below. My webpage has problem in displaying result position... from scanProfileData where ADSLNO='" + ADSL + "' order by DT DESC
JSP Request URI
with Example The Tutorial grasp the example from JSP Request URI. To understand... JSP Request URI          JSP Request URI is used to return the URI
Logging Filter Servlet Example
so that they become easy to manage, transforming request from a servlet to JSP... Logging Filter Servlet Example       Example program to demonstrate Logging Filter
Displaying image with byte array[] - Java Beginners
Displaying image with byte array[]  Hi Frndz.. As per my requirement i need to show an image by using an byte array object which have image data.../article-992927-6.html Here it describe how display image in jsp. Sorry I have
image upload with jsp from form
image upload with jsp from form  hi i used the code specified in your following post http://www.roseindia.net/answers/viewqa/JSP-Servlet/9749-image...) org.apache.jsp.upload_jsp._jspService(upload_jsp.java:85
jsp image problem - JSP-Servlet
jsp image problem  hi everyone, How to display multiple images from mysql database to jsp page. please help me
how to fetch image from mysql using jsp
how to fetch image from mysql using jsp  how to fetch image from mysql using jsp
Retrieving newly inserted records and displaying in jsp forever
Retrieving newly inserted records and displaying in jsp forever  Sir, here is my requirement, First i have to retrieve newly added 10 records from... record which is displayed in the jsp. I have to delete that record from the jsp
Jsp Image prob - JSP-Servlet
Jsp Image prob   I m working on a project i which i have to upload a image in jsp to database and then on next page i will show that image from database so what should i do as i have done first phase
Computer - JSP-Interview Questions
("mode", "Forwarding Response.."); } // Including response from Servlet2... the image button through my servlet with out using the anchor tag kindly give solution... ForwardServlet extends HttpServlet{ private static final String forwardTo = "/jsp
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
jsp request in struts1
jsp request in struts1  how the request for a JSp is processed in Struts1?Any JsP page in the end a servlet only.where is the URL pattern for this servlet
Inserting Image(s) - JSP-Servlet
and html form and explanation on how to insert and retrieve image from mysql. ...;This is retrive image code from database.import java.sql.*;import java.io.IOException... rs = null; String query = "SELECT image from uploadfile where firstname
Displaying the values in text fields of a form from a javascript function in jsp
Displaying the values in text fields of a form from a javascript function in jsp  Hi all, I have a requirement like this, First i have to call a javascript function by passing 3 values from applet. And i have
displaying employee records and their images problem - JSP-Servlet
displaying employee records and their images problem  hi, Thanks for your reply to my question. The code you sent to me yesterday was not working. it doesn't display any record and image. Please, help me out urgent
Request Object In JSP
Request Object In JSP     ... to the server, is received by the HTTP request object of the JSP. To access... either in the current JSP page or the another JSP page by passing the request
How display a Image on servlet from file upload - JSP-Servlet
How display a Image on servlet from file upload  Dear Sir, I were ask a question that How display the Image on servlet through file upload. Today I get your answer. But Sir, It code not display the image on servlet

Ask Questions?

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.