• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

weird thing happeing in my application

 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i a have servlet like this,
package jstlTest;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class jstlTest1 extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException
{
System.out.println("Inside Jstl test");

RequestDispatcher dis = req.getRequestDispatcher("jstltest.jsp");
dis.forward(req,res);
}
}

and in my DD
<servlet>
<servlet-name>jstlTest</servlet-name>
<servlet-class>jstlTest.jstlTest1</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>jstlTest</servlet-name>
<url-pattern>/jstlTest/*</url-pattern>
</servlet-mapping>
<!-- setting init parameters for a jsp -->

so now when i access this servlet via http://localhost:8080/myapp/jstlTest
everything happens normal.
But when i use the url http://localhost:8080/myapp/jstlTest/ things go awry.i mean only 'Inside Jstl test' is printed in console and request is not forwaded to the jsp.it just hangs there.There is filter which will be triggered for any urls.will that be a problem.

}
[ October 04, 2006: Message edited by: Senthil Kumar SS ]
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<url-pattern>/jstlTest/*</url-pattern>


might be wrong in this code. but i'm sure. everythign else seem no wrong.
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can sombody point out where is the mistake
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please show your filter mapping part int the DD and filter class coding
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is with
RequestDispatcher dis = req.getRequestDispatcher("jstltest.jsp");


Please try to use absolute path instead of relative.

As second case jstltest.jsp is not acessible, please check container logs it whould have the corresponding error
 
Venkat Perumalla
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just do with req.getRequestDispatcher("/jstltest.jsp");
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gee,
Now it's working guys when i use absolute path(with '/').but why is this?.I mean as long as i dont use request dispatcher in my servlet this doesn't make any difference('/' or without '/.').It works fine.
This happens only when i despatch requests.
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think in "http://localhost:8080/myapp/jstlTest/" it searches for an subdirectory of jstlTest. correct me if I'm wrong
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic