I created a JSP file. Earlier, it was an html file and the bootstrap was showing perfectly. Now, I changed it to a jsp file. So, when the user enters the URL, it routes via the Dispatcher Servlet and then the user see the jsp.
For some reason, the CSS formatting is not showing:
I am trying to display ipay.jsp:
Here is the file structure
The Servlet that maps to this JSP:
package com.tests;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/*
* author: Crunchify.com
*
*/
@Controller
public class CrunchifyHelloWorld {
@RequestMapping("/welcome1")
public ModelAndView helloWorld() {
String message = "HELLO HEY";
System.out.println("dpay");
return new ModelAndView("ipay", "message", message);
}
}
I changed the structure and code to as follows, still not working
HEre is my servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<mvc:default-servlet-handler/>
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/resources/" />
<context:component-scan base-package="com.stellar,com.tests" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Here is my web.xml:
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>stellar</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>stellar</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>