I am trying to serve static resources in the Spring mvc and drools project. To serve the static resources such as images ,css and js i tried to use the below:
1).
<!-- Enables the Spring MVC @Controller programming model -->
<mvc:annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<mvc:resources mapping="/resources/js/**" location="/resources/js/"/>
2).
For scanning the components i used:
<!-- Scans within the base package of the application for @Components to configure as beans -->
<context:component-scan base-package = "package-name" />
I have a form which loads after navigating to the new page , before using the 1 i am able to get the form loaded .
When i introduced 1 then i get the error as mentioned below:
HTTP Status 500 - org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [int] for value 'null'; nested exception is java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type
My questions::
Q1)I got one stackoverflow question stating the difference between the above two.I had not used annotation-driven earlier yet it was working as in the case mentioned.
Q2)I got this question which mentions both the 1 and 2 are required.
Q3)If i use only it gives 404 on form load page.
What is the thing that i am missing.
I am using spring mvc with spring 6 and drools 7.
EDIT:
I can see exception "java.lang.IllegalArgumentException: A null value cannot be assigned to a primitive type" in the console. Why is this only for primitive type only where as for String its not throwing exception.