Questions tagged [requestdispatcher]

The request dispatcher is used for receiving requests from the client and sending them to any resource (such as a servlet, HTML file, or JSP file) on the server.

The request dispatcher is used for receiving requests from the client and sending them to any resource (such as a servlet, HTML file, or JSP file) on the server. The most common approach is forward or include resource to the client.

The servlet container creates the RequestDispatcher object, which is used as a wrapper around a server resource located at a particular path or given by a particular name.

See RequestDispatcher API docs for details.

213 questions
0
votes
0 answers

What is the difference between different ways of creating RequestDispatcher Object?

There are different ways of creating a RequestDispatcher Object: Method 1: Using HttpRequest Object RequestDispatcher rd=request.getRequestDispatcher(); Method 2: Using ServletContext Object RequestDispatcher…
0
votes
2 answers

JSP code displays null even though attribute was sent

I ran out of ideas. I printed my ArrayList books which I send from my Servlet and it is displaying null all the time. When I printed that array in Servlet it displays correct set of data. Maybe you can help me: This is Servlet: private void…
Luke_Nuke
  • 461
  • 2
  • 6
  • 23
0
votes
0 answers

asking to use GET in a servlet where i have only used POST method

This is my html code <%@page contentType="text/html" pageEncoding="UTF-8"%> New Page
0
votes
1 answer

How to save multiple form data using one submit button

In my jsp page I have two forms.one form action goes to save_product servlet and other one is goes to save_images servlet. There is only one submit button. when click submit button first I want to save products and then want to save images. I…
Poorna Senani Gamage
  • 1,246
  • 2
  • 19
  • 30
0
votes
0 answers

Strange behavior of AEM Dispatcher:

We are using AEM 6.2 with Dispatcher 4.2 and after each page refresh the cache is not considered for response. There are Secure content which are secured by /auth_checker and cached by /allowAuthorized. The URL of content is as…
Dileepa
  • 1,019
  • 1
  • 15
  • 40
0
votes
4 answers

Spring mvc - initial loading page issue

I am trying to have hello.jsp page as an output but it goes to index.jsp page all the time. I tried searching various other things but failed, so finally decided to post here so any one of you can help. Below I have attached my project structure and…
0
votes
0 answers

How request has the attribute without assigning from setAttribute() method before RequestDispatcher?

When we are trying to forward request using RequestDispatcher from servlet to jsp we user request.setAttribute()method. request.setAttribute("uname", name); RequestDispatcher rd = request.getRequestDispatcher("welcome.jsp"); …
Dil.
  • 1,996
  • 7
  • 41
  • 68
0
votes
1 answer

Css can't be loaded when i send data from a servlet

My CSS Stylesheets don't load any JSP page if i send any data to the JSP page the CSS don't load . and when i only use response.sendRedirect( ) without data the CSS can be loaded correctly List specialite = new ArrayList<>(); Query…
0
votes
2 answers

React: cannot retrieve data from a server (dispatch)

it's my first time working with React and I'm having a few problems when I try to get some data. My problem is inside getChargesByUser() method where I just written two console.logs, the first one it shows but the second one not, that means that I'm…
CanKer
  • 430
  • 4
  • 8
  • 29
0
votes
0 answers

RequestDispatcher forward method does not forward

I have a JEE application that uses JQuery / DataTabes, etc I have an Authenticate routine that checks if the signed on user has permission to run the program. This works up to the point where it should forward to my 'Unauthorized' page. Instead it…
Ainsworth
  • 69
  • 3
  • 8
0
votes
0 answers

Java: HTTP Status 405 - using RequestDispatcher and doPost()

I have a simple program which get username and password, if the password is servlet then it will forward to the welcome page, else, it will show a message and includes html login form. When I enter username and password and click on login, no matter…
HMD
  • 468
  • 1
  • 5
  • 21
0
votes
1 answer

unicode characters are not displayed when requestdispatcher.forward is used to redirect to a page

I my creating an application which supports English and Japanese languages. I'm using resource bundle and property files. Problem is occuring when I use request dispacther to forward the request to another JSP file: RequestDispatcher rd1 =…
0
votes
1 answer

Request dispatcher forward method not working in do post method on servlet

forward method in request dispatcher works fine when created in doGet() method in Servlet. But does not work when used in the dopost method. Also in Jsp file I have declared the method as doPost. Following is my code in servlet. @WebServlet(name =…
0
votes
1 answer

Make JSP accessible via RequestDispatcher#include only

The problem I am trying to solve is that I have a web project running on Tomcat 7 with mostly publicly accessible JSP pages, but also with a few JSP pages that are not meant to be publicly accessible. These "private" pages are used by various…
Jason C
  • 38,729
  • 14
  • 126
  • 182
0
votes
1 answer

Requestdispatcher Nullpointer Exception

i have following Servlet Code: @WebServlet("/Login") public class Login extends HttpServlet { private static final long serialVersionUID = 1L; public String lang = ""; /** * @see HttpServlet#HttpServlet() */ public Login() { super(); //…
Kevin Barz
  • 31
  • 2
  • 9