Re: Testing servlet redirects

Kazuhito SUGURI <[email protected]>
Newsgroups gmane.comp.jakarta.cactus.user
Message-ID <[email protected]>
Hi Karthik,

In article <[email protected]>,
Wed, 21 Jun 2006 18:32:48 +0530,
"karthik" <[email protected]> wrote: 
karthikn>   The example provided on the site is something confusing....

Please point out what confuses you.

karthikn>   If u hava a sample working test case with war file,please
karthikn>   provid me the same. so i can correct my self.

A sample.

    public class SampleTest
        extends ServletTestCase
    {
        public SampleTest(String name)
        {
            super(name);
        }
        public void testJsp()
            throws Exception
        {
            session.setAttribute("testKey", "testValue");
            RequestDispatcher rd = request.getRequestDispatcher("/test.jsp");
            rd.forward(request, response);
        }
        public void endJsp(WebResponse response)
        {
            System.out.println(response.getText());
        }
    }


test.jsp:
    <%= session.getAttribute("testKey") %>


Regards,
----
Kazuhito SUGURI
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.