forward() across webapps II
http://hoare.cs.umsl.edu/servlet/j-siegel/studentTest
studentTest.java in j-siegel
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.*;
import javax.servlet.http.*;
import mybeans.*;
public class studentTest extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
SQLBean thestudent = new SQLBean();
thestudent.setAll("Joe Jones");
req.setAttribute("student", thestudent);
res.setContentType("text/html;charset=UTF-8");
ServletContext src = req.getSession().getServletContext();
ServletContext target = src.getContext("/js_mini");
RequestDispatcher rd = target.getRequestDispatcher("/showStudent.jsp");
rd.forward(req, res);
}
}
js_mini
web.xml in js_mini (no servlets)
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
</web-app>