I have two server and i can call jsp of another server from my server's jsp.
like following code. First Server JSP.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<form method="post" action="http://localhost:8080/Second_App/index.jsp">
Name : <input type="text" name="name"/>
Surname : <input type="text" name="surname"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
When i click on Submit the control will go in second server it will take name as parameter and put it into my Second Server's jsp.
Second Server JSP.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<%
String name = (String) request.getParameter("name");
String surName = (String) request.getParameter("surname");
%>
Name : <%= name %>
Surname : <%= surName %>
</body>
</html>
i want to do exact same thing using Servlet.
I tried with Servlet's Redirect my control will go to Second server but because of Redirect it will not take "name" peramater.
I tried with Forward but it is also not working because it is finding that jsp in first server.
RequestDispatcher dispatcher = request.getRequestDispatcher("http://server2/app1/index.jsp");
dispatcher.forward(request, response);
My concern is JSP is Servlet. If this is done with jsp that means there should be some way for doing it with servlet.
Thanks.