Struts 1.2 : Unable to load a jsp as Action class isn't called

853 Views Asked by At

I am enhancing a pre-existed code in Struts 1.2. I am supposed to add a tab called prcm admin. I have made following entries in main xml files and jsp. Also I have an action class with method getViewPriceManagementAdmin.

When I tried to debug this code it seems that control doesn't reach action class at all.

I have checked all the calls and everything looks correct. Only a blank tab is loaded in my application.

I have also shared the error I get on my console.

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>

tiles-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;

console output

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)
1

There are 1 best solutions below

0
On

Of course you can't reach the action because you have wrong url in JS code.

case "PrcmMgmtAdmin": window.location = "prcmMgmtAdmin.do?methodName=getViewPriceManagementAdmin";
break;

You can use html:rewrite tag to rewrite the url in the JSP

case "PrcmMgmtAdmin": window.location = "<html:rewrite action='prcmMgmtAdmin'/>"+"?methodName=getViewPriceManagementAdmin";
break;