开发者

How to get back to same page after server side processing?

Thinking that , in struts 1.2, say a function public ActionForward abc(){ return null;} will return to the same page. But i got this exception. java.lang.NullPointerException org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:441) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) javax.servlet.http.HttpServlet.servic开发者_开发问答e(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)

How to get into the same page?


You can use

return mapping.getInputForward();


In struts-config.xml, write a forward tag inside your action tag like this.

<action ...>
<forward name = "samePage" path="..."/>
</action>

Now, in your code use

mapping.findForward("samePage");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜