tags:

views:

210

answers:

2

Currently I fail to getRequestDispatcher from Struts2 as below:

RequestDispatcher rd = httpReq.getRequestDispatcher("/category.htm");

Error was show as below:

The requested resource (/xxxx/category.htm) is not available.

but it working well when http:/xxxx/yyyy/category.htm?id=21 execute does anyone have idea?

+1  A: 

If it works with the /category.htm URL hitting ?id=21, but that goes to /xxx/yyy/category.htm, then you're not making the same request as the final URL in your getRequestDispatcher() invocation. Try this instead:

RequestDispatcher rd = httpReq.getRequestDispatcher("/yyy/category.htm");
John Feminella
A: 

Problem resolve with post below, anyway, thanks John for your reply :)

http://old.nabble.com/Block-accessing-in-some-path-with-filter.-td23631279.html

What I did is just added these into filter-mapping element for struts filter in web.xml:

   <dispatcher>REQUEST</dispatcher>
   <dispatcher>FORWARD</dispatcher>
Dickson