Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


suresh anugandula
forwarding request to a jsp from a filter and displaying image in that jsp
1 Answer(s)      2 years and 11 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


Advertisement
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 Tutorials/Questions & Answers:
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
Advertisements
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 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 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
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
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
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
how to fetch image from mysql using jsp
how to fetch image from mysql using jsp  how to fetch image from mysql using jsp
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     
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
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 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
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
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
How Can I get ArrayList of Data from jsp with ajax request
How Can I get ArrayList of Data from jsp with ajax request  Hi, I retereved 5 Employee Record of Data from Struts Action class to jsp with ajax response. But I don't how how can reterve this dynamic 5 employee records
Retrview image from sqlserver2000 and display in jsp - JSP-Servlet
Retrview image from sqlserver2000 and display in jsp  How to retreview image from sqlserver2000 to jsp? pls give the solution i am using Tomcat 4... for more information, http://www.roseindia.net/jsp/ Thanks
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
image displaying from database with some other information
image displaying from database with some other information  hi, in the following section of code when i am not displaying the image it is working...=con.prepareStatement("select img,aname,aemail from image inner join admin
Request for codes - JSP-Servlet
Request for codes  Sir , I am an engineering student i am interested in learning JAVA also i need some example code for creating Registration form codes for creating web based application using JSP sir plz send me which
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
not picking request parameters from the front end - JSP-Servlet
not picking request parameters from the front end  hi, This is venkatramana. I am writing one small basic program. I am not getting proper output. As per the code i should get output as Hello welcome to unice:venkat(which name
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
retrive image from database using jsp without stream
retrive image from database using jsp without stream  How to retrive image from database using jsp without stream like (inputStream
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
Advertisements
 

 

 

DMCA.com