我正在增强Struts 1.2中预先存在的代码。
我应该添加一个名为prcm admin
的标签。
我在主xml文件和jsp中做了以下条目。
我还有一个方法getViewPriceManagementAdmin
的动作类。
当我尝试调试此代码时,似乎控件根本没有达到动作类。
我检查了所有电话,一切看起来都正确。我的应用程序中只加载了一个空白选项卡。
我也分享了我在控制台上遇到的错误。
struts-config.xml
<action path="/prcmMgmtAdmin"
type="mypackage.web.action.prcmadm.PrcmMgmtAdminAction" name="prcmMgmtForm"
parameter="methodName" scope="request"
validate="false">
<forward name="PrcmMgmtAdmin" path="prcmMgmtAdmin" contextRelative="true" />
</action>
action-servlet.xml文件
<bean name="/prcmMgmtAdmin" class="mypackage.web.action.prcmadm.PrcmMgmtAdminAction">
</bean>
瓦片-def.xml
<definition name="prcmMgmtAdmin" extends="template" >
<put name="body" value="PrcmMgmtAdminView" />
</definition>
<definition name="PrcmMgmtAdminView" page="/WEB-INF/jsp/prcmMgmtAdminView.jsp" >
</definition>
header.jsp中
case "PrcmMgmtAdmin": window.location = "prcmMgmtAdmin.domethodName=getViewPriceManagementAdmin";
break;
控制台输出
23:17:23,721 INFO [STDOUT] 06-18-2015, 23:17:23721, DEBUG, [org.springframework.jdbc.core.StatementCreatorUtils], - Setting SQL statement parameter value: column index 1, parameter value [STAT_CD], value class [java.lang.String], SQL type 1
23:17:32,236 INFO [STDOUT] 06-18-2015, 23:17:32235, ERROR, [mypackage.web.action.prcmadm.PrcmMgmtAdminAction], - mypackage.web.security.UserPrincipal@bb51061
23:17:32,237 INFO [STDOUT] 06-18-2015, 23:17:32237, ERROR, [mypackage.web.action.prcmadm.PrcmMgmtAdminAction], - errorPage::null
23:17:32,292 INFO [STDOUT] 06-18-2015, 23:17:32287, ERROR, [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/markdownWeb].[jsp]], - Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.WEB_002dINF.jsp.common.error_jsp._jspService(error_jsp.java:110)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:614)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:101)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:137)
答案 0 :(得分:0)
当然,由于JS代码中的URL错误,您无法访问该操作。
case "PrcmMgmtAdmin": window.location = "prcmMgmtAdmin.do?methodName=getViewPriceManagementAdmin";
break;
您可以使用html:rewrite
标记重写JSP
case "PrcmMgmtAdmin": window.location = "<html:rewrite action='prcmMgmtAdmin'/>"+"?methodName=getViewPriceManagementAdmin";
break;