struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "hou wj (JIRA)" <>
Subject [jira] [Created] (WW-3862) help,request.getServletPath() still return null
Date Tue, 07 Aug 2012 03:09:02 GMT
hou wj created WW-3862:

             Summary: help,request.getServletPath() still return null
                 Key: WW-3862
             Project: Struts 2
          Issue Type: Improvement
          Components: Dispatch Filter
    Affects Versions: 2.3.1
         Environment: websphere 7.0.12,struts2.3.1.1,jdk1.5
            Reporter: hou wj

I tried the URL you provided like this,【】。

I don’t want a temporary fix,so I try the solution of servlet LaunchServlet as you provided
like this:
1) add a servlet that initializes the Struts Dispatcher with the servlet context:
import org.apache.struts2.dispatcher.Dispatcher;
public class LaunchServlet extends HttpServlet implements Servlet {
    public LaunchServlet() {
    public void init(ServletConfig arg0) throws ServletException {
            // this works around a bug in the websphere classloader.
            Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String, String>());

2) launch it at start-up (web.xml):
3) Run application and everything should work. 

But it not works ,the method request.getServletPath() still return null

I use struts2.3.1,and websphere 7.0.12

Follws is before my issue:
I use as follows
I create a class:
public abstract class BaseAction extends ActionSupport implements
ServletRequestAware, ServletResponseAware, ServletContextAware {
protected HttpServletRequest request;
protected HttpServletResponse response;
protected HttpSession session;
public String getServletPath(){ return request.getServletPath(); }
// get / set method
public void setServletRequest(HttpServletRequest request) {
       this.request = request;

public void setServletResponse(HttpServletResponse response) {
       this.response = response;

public void setServletContext(ServletContext context) {
       this.context = context;
now ,in tomcat 5.5 run environment,getServletPath() method can return correct value,but in
websphere 7,it return null.first,i distrust it is some problem in i create a simple
jsp file and write above code in new jsp file,very magical,it return correct value.i arrive
the net to look for the answer.but,nothing i's struts bug?Looking forward to reply.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message