Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to map requests to HTML file in Spring MVC?
    primarykey
    data
    text
    <p>Basic configuration files looks unintuitive. </p> <p>If I create simple hello world example, and then rename <code>home.jsp</code> to <code>home.html</code> and edit <code>servlet-context.xml</code> file from</p> <pre><code>&lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt; &lt;beans:property name="suffix" value=".jsp" /&gt; &lt;/beans:bean&gt; </code></pre> <p>to </p> <pre><code>&lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt; &lt;beans:property name="suffix" value=".html" /&gt; &lt;/beans:bean&gt; </code></pre> <p>I start to get an error</p> <pre><code>WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/myapp/WEB-INF/views/home.html] in DispatcherServlet with name 'appServlet' </code></pre> <p>Why? What <code>suffix</code> property means?</p> <p><strong>UPDATE</strong></p> <p>My controller is follows. As you see it does not contain file extension</p> <pre><code>@Controller public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! The client locale is {}.", locale); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate ); return "home"; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload