• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

weird thing happeing in my application

 
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 ]
 
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
 
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
 
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
 
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
 
Acetylsalicylic acid is aspirin. This could be handy too:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!