Skip to content

Instantly share code, notes, and snippets.

@kawasima
Created September 25, 2012 08:15
Show Gist options
  • Save kawasima/3780588 to your computer and use it in GitHub Desktop.
Save kawasima/3780588 to your computer and use it in GitHub Desktop.
How to enable PUT and DELETE method in sastruts
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionServlet;
@SuppressWarnings("serial")
public class RestfulActionServlet extends ActionServlet {
public void doPut(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
process(request, response);
}
public void doDelete(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
process(request, response);
}
}
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>xxx.RestfulActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>configFactory</param-name>
<param-value>org.seasar.struts.config.S2ModuleConfigFactory</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment