Monday, 15 July 2013

java - JSP not Evaluating with Spring MVC -



java - JSP not Evaluating with Spring MVC -

i trying render jsp in spring 3.2 using annotation driven configuration, jsp renders string , not evaluated.

i using maven jetty plugin run webapp in development. seems if should "just work".

the dependencies including utilize jsp are

<dependency> <groupid>javax.servlet.jsp</groupid> <artifactid>jsp-api</artifactid> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency>

the bean configure jsp

@configuration public class webappconfiguration { @bean public internalresourceviewresolver internalresourceviewresolver() { internalresourceviewresolver resolver = new internalresourceviewresolver(); resolver.setprefix("/views/"); resolver.setsuffix(".jsp"); homecoming resolver; } }

the controller pretty straight forward

@controller public class rootcontroller { @requestmapping(value = "/login") public string login() { homecoming "login"; }

and jsp pretty easy

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8" %> <!doctype html> <html> <head></head> <body> <%= "hello world" %> ${ "hello world" } <form name="auth" action="<c:url value='j_spring_security_check' />" method="post"> <label>username: <input type="text" name="j_username"></label> <label>password: <input type="password" name="j_password"></label> <input type="submit" value="submit"/> </form> </body> </html>

as can see image jsp not beingness evaluated. there need tell jsp evaluated when rendered.

edit 1

so little info used resthub archetype resthub-mongodb-backbonejs-archetype bootstrap project, uses webappinitializer rather older web.xml, , uses new annotation driven beans rather xml beans.

edit 2

i have been smashing head on long set project on github https://github.com/austinbv/calendar/. since not know of import , not.

thanks help

@austinbv please utilize spring link check setup. (as @rohit has pointed above - missing piece)

java jsp spring-mvc

No comments:

Post a Comment