मैं वेब एप्लिकेशन के लिए कस्टम त्रुटि पृष्ठों को लागू करना चाहता हूं।स्प्रिंग एमवीसी: त्रुटि पेज और मुख्य जानकारी
web.xml
<error-page>
<error-code>404</error-code>
<location>/404/</location>
</error-page>
वसंत-security.xml
<http use-expressions="true">
<form-login ... />
<access-denied-handler error-page="/403/" />
....
</http>
दोनों पृष्ठों उचित नियंत्रक द्वारा नियंत्रित किया जाता है: मैं निम्नलिखित तरीके का उपयोग करें। लेकिन ऐसा लगता है कि principal
इस मामले में अनुपयोगी है यानी मुझे वर्तमान में लॉग इन उपयोगकर्ता के बारे में कोई जानकारी नहीं मिल सकती है।
क्या यह डिफ़ॉल्ट व्यवहार है या मुझे कोड में कोई त्रुटि है?
धन्यवाद
युपीडी # 1: मेरे config:
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-service.xml
/WEB-INF/spring-security.xml
/WEB-INF/spring-data.xml
/WEB-INF/spring-mail.xml
</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
कैसे क्या आप web.xml फ़ाइल में सुरक्षा फ़िल्टर को मैप करते हैं? – Pastur
@AbelPastur अपडेट देखें – nKognito