• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

problem in ResourceBundleViewResolver

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Am writing a sprig application..in this am trying to render view using ResourceBundleViewResolver..

but am getting exception..

my properties file is under source file in eclipse..
my jsp folder is under webcontent..

can somebody please help me out from this...

am placing my code below


web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

<welcome-file-list>
<welcome-file>jsp/input.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>Application</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Application</servlet-name>
<url-pattern>*.form</url-pattern>
</servlet-mapping>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/Application-servlet.xml
</param-value>
</context-param>


Application-Servlet.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<import resource="ApplicationContext.xml" />

<bean id="bundleViewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
<property name="basename" value="/views">
</property>
</bean>

</beans>


Applicatio-context.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="com.*.controller, com.*.service, com.*.dto"/>

<!-- <context:annotation-config/> -->

</beans>

views.properties file
home.class=org.springframework.web.servlet.view.JstlView
home.url=/jsp/home.jsp

controller

@Controller
public class SampleController {

@RequestMapping("/home.form")
protected ModelAndView handleSampleRequest(HttpServletRequest request,
HttpServletResponse response, @ModelAttribute("person") Person person)throws Exception {

System.out.println("---------------entering controller");
return new ModelAndView("home", "message", person);
}
}

home.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body bgcolor="wheat">
<h2>${message.age}</h2>
<h2>${message.name}</h2>
</body>
</html>

thanks in advance..
sachin
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please edit your post and UseCodeTags. There is a lot of code there and its hard to read if its not formatted.

but am getting exception..



Always post the full stack trace for your exception. Otherwise we can't easily identify what the problem is.
 
sachin roy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Am writing a sprig application..in this am trying to render view using ResourceBundleViewResolver..

but am getting exception..

my properties file is under source file in eclipse..
my jsp folder is under webcontent..
abd i used annotations in my controller class..

can somebody please help me out from this...

am placing my code below


web.xml



Application-Servlet.xml



views.properties file
home.class=org.springframework.web.servlet.view.JstlView
home.url=/jsp/home.jsp


thanks in advance..
sachin
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sachin,

Thanks for using the code tags, but you have forgotten once again to post the full stack trace for the exception you are receiving. Without providing us with this information we cannot really know what kind of problem we are looking for.

but am getting exception..



What kind of exception? What is the stack trace? Is it on start-up or at runtime?
 
sachin roy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill Gorder,

that issue is solved..

in views.properties i just changed below declaration.. its worked fine..

home.(class)=org.springframework.web.servlet.view.JstlView

Thanks Bill.
reply
    Bookmark Topic Watch Topic
  • New Topic