[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

how can i change struts source??

hi,experts,now i want change the process method in jakarta-struts-1.1/lib/struts.jar/org/apache/struts/action/ActionServlet.class

now i hava down the jakarta-struts-1.1 source and in ActionServlet.java,i add two lines,like this:
    /**
     * Perform the standard request processing for this request, and create
     * the corresponding response.
     *
     * @param request The servlet request we are processing
     * @param response The servlet response we are creating
     *
     * @exception IOException if an input/output error occurs
     * @exception ServletException if a servlet exception is thrown
     */
    protected void process(HttpServletRequest request,
                           HttpServletResponse response)
        throws IOException, ServletException {
          request.setCharacterEncoding("gb2312");  //i added it
         response.setContentType("text/html;charset=gb2312"); //i added it

        RequestUtils.selectModule(request, getServletContext());
        getRequestProcessor(getModuleConfig(request)).process
            (request, response);

    }

but when i add it ,i can not compile it, can any experts help me compile it and send me struts.jar, thanks very much!

mymail:jbasttdi@hotmail.com

thanks very much!
0
hgbdelphi
Asked:
hgbdelphi
  • 2
  • 2
1 Solution
 
TimYatesCommented:
1) write your own class which extends ActionServlet
2) just override the process method (like you have done)
3) in WEB-INF/web.xml, change:

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

to

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>your.package.MyActionServlet</servlet-class>

That should then work...
0
 
hgbdelphiAuthor Commented:
hi, TimYates

thanks for your help,but when i write my self ActionServlet,i can not compile it,
javac my.package.MyActionServlet  can not comile,how can i do it?
0
 
hgbdelphiAuthor Commented:
hi,thanks very much,when i add some org.apache lib ,it can compile,thanks ,and my code can run well,thanks very much!

 Best Regard For you!
0
 
TimYatesCommented:
Yay!  Glad I could help :-)

Good luck with it all!!

Tim
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now