Hello,

--- Vincent Massol <[EMAIL PROTECTED]> wrote:

> Why do you have a "*" in your mapping ? Any reason for that ?
> I would suggest rather (as defined on the web site and in the
> Cactus sample
> application) to have :
> 
> <servlet-mapping>
>         <servlet-name>JspRedirector</servlet-name>
>         <url-pattern>/JspRedirector/</url-pattern>
>     </servlet-mapping>
> 
> I don't see how this could change anything but still it is more
> correct.
   Hello I changed the mistake you notified. Now I have very strange
behaviours. Let me illustrate the case.

Here is my hello.jsp  file:

<html>
<head><title>Hello World</title></head>
<body>
        <% session.putValue("name" , "RED" ); %>
        <% out.print("<p><b>Hello Your Universe!</b>"); %>
</body>
</html>

I have placed it under the context examplesWebApp in my server such
that, if I point to 

http://localhost:7001/examplesWebApp/hello.jsp , the above jsp gets
activated and so I get "Hello Your Universe" on the client( browser
).
Now I want to test the value of the attribute stored by session on
the server  and my test case looks something like this.

<  ---  JAVA TEST CASE CODE --->
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import java.io.*;

import junit.framework.*;

import org.apache.commons.cactus.*;

public class TestJspTestCase extends JspTestCase
{
    static final String FORWARD_URL = "hello.jsp" ;

    public TestJspTestCase(String theName)
    {
        super(theName);
    }

    public static void main(String[] theArgs)
    {
        junit.ui.TestRunner.main(
                new String[] {TestJspTestCase.class.getName()});
    }

    public static Test suite()
    {
        return new TestSuite(TestJspTestCase.class);
 }

public void beginOut(ServletTestRequest str) throws Exception {
}

    public void testOut() throws IOException, ServletException
    {
        pageContext.forward(FORWARD_URL);
        assertEquals(pageContext.getAttribute("name"), "LG"  );
    }

    public void endOut(HttpURLConnection huc) throws IOException
    {
    }
}

<--- > 


To my surprise the assertion passes. Actually I am setting the value
to be RED in the jsp and asserting it to be LG . It should fail. But
it passes . Where is it that I  have gone wrong ? 

Please help me.

thanks.




=====
Thanks.
Rakesh Bhalla.

__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

Reply via email to