Action becomes NULL with Spring MVC Tiles

Asked 2 years ago, Updated 2 years ago, 91 views

We use Spring MVC+Tiles to develop web apps.
The action of the form tag was set to NULL when I set the following settings.
I checked the compiled JSP file and found that the Action name was set correctly.
Also, if you configured Spring 3.2.15 + Tiles 2.2.2, the action name was set correctly.

If anyone knows, please give me some advice.

Spring Framework: 5.0.8.RELEASE
org.apache.Tiles:3.0.8

web.xml

<servlet>
     <servlet-name>spring</servlet-name>
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
     <servlet-name>spring</servlet-name>
     <url-pattern>*.html</url-pattern>
   </servlet-mapping>

bean.xml

<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
     <property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/>
     <property name="redirectHttp10Compatible" value="false"/>
   </bean>
   <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
     <property name="definitions">
       <list>
         <value>/WEB-INF/tiles_common.xml</value>
       </list>
     </property>
   </bean>

JSP

<form:form modelAttribute="loginModel" action="login.html"autocomplete="off" id="loginModel" method="POST">

html

<form id="loginModel" action="null" method="POST" autocomplete="off">

login_jsp.java

_jspx_th_form_005form_005f0.setPageContext(_jspx_page_context);
   _jspx_th_form_005form_005f0.setParent(null);
   // /WEB-INF/views/login/login.jsp(2,0)name=modelAttribute type=null requTime=true required=false fragment=false expectedValue=false expectedTypeName=null deferredMethod=false methodSignature=null expectedMethodSignature nnull required
   _jspx_th_form_005form_005f0.setModelAttribute("loginModel");
   // /WEB-INF/views/login/login.jsp(2,0)name=action type=null requTime=true required=false fragment=false expectedValue=false expectedTypeName=null defaultMethod=false methodSignature=null
   _jspx_th_form_005form_005f0.setAction("login.html");
   // /WEB-INF/views/login/login.jsp(2,0)name=autocomplete type=null requTime=true required=false fragment=false definedValue=false expectedTypeName=null definedMethod=false methodSignature=null
   _jspx_th_form_005form_005f0.setAutocomplete("off");
   // /WEB-INF/views/login/login.jsp(2,0)name=id type=null reqTime=true required=false fragment=false expectedValue=false expectedTypeName=null definedMethod=false methodSignature=null
   _jspx_th_form_005form_005f0.setId("loginModel");
   // /WEB-INF/views/login/login.jsp(2,0)name=method type=null requTime=true required=false fragment=false definedValue=false expectedTypeName=null definedMethod=false methodSignature=null
   _jspx_th_form_005form_005f0.setMethod("POST");

spring mvc

2022-09-30 17:05

1 Answers

The symptom has been resolved.

I was using RequestDataValueProcessor.
Failed to set null in processAction method.

I also found answers to similar events.

https://stackoverflow.com/questions/44647285/action-name-is-null-in-spring-4-mvc


2022-09-30 17:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.