Let me see if I get this right; 1. If you trying to see second JSP overriding th first one, try to use forward() instead of include() 2. If you trying to show the first one and then 5 sec later the second one I don't think this is the right technic since I don't believe the page will be displayed until the method returnes Alex
-----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Kam Premkumar Sent: Friday, December 14, 2001 12:46 PM To: [EMAIL PROTECTED] Subject: thread sleep between jsp includes please look at the code . I am trying to include one .jsp and making the current thread to sleep for 5 sec then icluding one more jsp. But both included jsps coming to screen same time > i included the code for your refernce guys. Thanks Prem import java.io.*; import java.text.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorldExample extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = new PrintWriter(response.getWriter(),true); String inxml="HelloWOrld"; request.setAttribute("myData", inxml ); getServletConfig().getServletContext().getRequestDispatcher("/jsp/test.jsp") .include(request, response); try { System.out.println("Entering into the loop 1"); Thread.currentThread().sleep(5000); } catch(Exception ex1) { System.out.println(ex1.getMessage()); } String inxml1="Helo WOrld1"; request.setAttribute("myData1", inxml1 ); getServletConfig().getServletContext().getRequestDispatcher("/jsp/test1.jsp" ).include(request, response); } } test.jsp ======== <% String s =(String)request.getAttribute("myData"); out.println(s); %> test1.jsp ======== <% String s1 = (String)request.getAttribute("myData1"); out.println(s1); %> =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
