jsp 1 « MVC « Spring Q&A

1. Spring MVC and JSP framework    stackoverflow.com

What is a very good jsp framework to use with Spring MVC. Are the only candidates SiteMesh and Tiles, and others?

2. Retrieving a model from ModelAndView in jsp    stackoverflow.com

I am currently trying to return a model from onSubmit() in my controller. I then am trying to retrieve this in my jsp. for example

Map model = new HashMap();
model.put("errors", "example error");
return new ...

3. JSPs not displaying objects from model in Spring    stackoverflow.com

I have what should be an easy issue to solve, but I'm having no luck. In my servlet-servlet.xml file, I have the following beans (in addition to others):

<bean id="viewResolver"
 <property name="viewClass" ...

4. Spring MVC - jsp not rendering    stackoverflow.com

I'm just starting with Spring MVC trying to create a new project, and came accross an issue for which no manual or tutorial seems to help... I have set up a simple ...

5. Is it possible to pass a strongly typed model to a view/jsp page?    stackoverflow.com

In spring mvc, I noticed the models are passed as a name/value pair into the ModelAndView. is it possible to create a strongly typed model and pass it to the view? this way ...

6. including style sheet in a jsp page with Spring MVC    stackoverflow.com

I am having trouble linking to a style sheet from a jsp page. I believe it has something to do with my directory structure which is:

  |-- css
  | ...

7. ModelAttributes not accessible on jsp    stackoverflow.com

Created a new Spring MVC project using MAven and Im having a problem where the modelAttributes are not getting substituted on the jsp page. For eg.,

<%@ page session="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" ...

8. sample_en.jsp and sample_fr.jsp in Spring MVC    stackoverflow.com

I am trying to setup Spring MVC 3.0 to support localization. The messages are in messages_en.properties and messages_fr.properties. It works, but I cannot figure out how to support localized JSP pages. ...

9. Setting the default jsp view with spring mvc    stackoverflow.com

I want to set one of jsp files in my jsps folder as the default view for the application. Is there any way we can tell in <welcome-file-list> that abc.jsp needs ...

10. Spring MVC jsp list of objects    stackoverflow.com

I use Spring MVC 3.0 and JSP. I have an object:

public class ObjectWrapper {
    private List<SomeTO> someTOs;
Class SomeTO contains fields like name and id. How can I create ...

11. Spring MVC working with Web Designers    stackoverflow.com

When working with web-designers in a Spring-MVC and JSP environment, are there any tools or helpful patterns to reduce the pain of going back and forth from HTML to JSP and ...

12. Serving Advertisements - What should the View be responsible for?    stackoverflow.com

My requirements are that Ads have a definite size, could be different media types (although I'd like to focus on Images first) and need to have their impressions tracked I'm using Spring-MVC ...

13. Java / Spring / JSP - how to output value added using ModelAndView.addObject    stackoverflow.com

I have the following code in my controller

final ModelAndView m = new ModelAndView();
m.addObject("date", "15" );
In my view I have been able to output this by doing
However how can I print it ...

14. Alternatives to JSP for Spring MVC view layer    stackoverflow.com

I'm looking to create a new app from scratch and will probably use Spring MVC and possibly Spring Web Flow. The projects created by Spring Roo use Spring MVC and ...

15. @ExceptionHandler doesn't handle the thrown exceptions    stackoverflow.com

I have a method in my controller which will handle the exceptions thrown by the application. So I have a method like this one.

public class ExceptionController {


16. Spring MVC environment specific information on JSP    stackoverflow.com

What is the best of displaying environment specific information (Dev, QA etc.) on the view JSP in Spring? I am thinking of reading that information from a properties file. Whats the ...

17. Resolving views in Spring MVC with Freemarker - including jsp page    stackoverflow.com

When using the FreemarkerServlet, it is possible to include JSP pages alongside Freemarker content. However, I'm using Freemarker as a view resolver in my Spring MVC application and so don't use ...

18. Input not firing in jsp page    stackoverflow.com

i have been using the spring mvc frameworks lately for a university project. Could you tell me why this work

     <input type="image" class="floatR marginTMinus10" ...

19. Spring 3 - Theme with separate JSP    stackoverflow.com

I'm trying to rewrite some Spring 1.2 code to Spring 3.0 one. Currently I'm stuck with JSP resolved by URL problem. Application uses separate JSP files with different layouts for serving ...

20. Spring MVC - JSP - Place to Store Environment Specific Constants    stackoverflow.com

Where in the Spring-MVC/JSP application would you store things that need to be accessed by both the controllers and views such as environment specific base_url's, application ids to be used in ...

21. JSP Component Creation    stackoverflow.com

When creating JSP pages one thing that I'd often like is the ability to do something like this:

<jsp:include page="fancystoryrenderer.jsp" value="${aStoryObjectInMyModel}/>

<div id="fancymainbody">

22. When using .jsp's view spring mvc, and passing ModelAndView, how to output model?    stackoverflow.com

If I have a modelandView like:

ModelAndView mav = new ModelAndView();

mav.addObject("message", "hello, world");

return mav;
In index.jsp, how do I output the value of "message"? And what if I passed in:
mav.addObject("user", currentUser);
It seems ...

23. How to send Jsp as response to ajax call    stackoverflow.com

i want to send a jsp page which consist of some divs and table as part of ajax response from spring frame work, is there any way to send jsp ...

24. Print org.w3c.dom.Document on jsp    stackoverflow.com

I'm sending from spring controller ModelAndView with object org.w3c.dom.Document. So I need to print it on my jsp without scriplets. Is there any way to do this with jstl? ThanX))

25. Spring MVC: best way to set global debug flag    stackoverflow.com

I'm using Spring MVC and my jsp's have a

<div id="debug">
section that I would like to be able to show/turn off conditionally while we are in development. For example, if ...

26. how to display an object on jsp page?    stackoverflow.com

i m pretty new to Spring MVC, i m trying to setup a page to display user information I have trouble with the controler and the view. Controler (getDetail returns a User object, ...

27. Render partial JSP fragments in Spring MVC?    stackoverflow.com

I am quite new to Spring MVC, and trying to figure out how to render a partial view without refreshing the whole page. I thought:

  • if I can post a request to ...

28. Spring MVC 3.0 + jsp footer    stackoverflow.com

I'm writing Sping MVC based application all my methods inside a controller return ModelAndView objects. What I would like to do is to apply standard HTML footer on each JSP page, like ...

29. How to pull out common pieces of view code in my Spring MVC website    stackoverflow.com

Here is my problem: My Spring MVC website is going to rely a lot on external JavaScripts/CSS/Images. This domain needs to be configurable. Also, I'd like to be able to ...

30. Spring MVC - Drop Down Object Selection - No primary identifier    stackoverflow.com

A fairly common use case occurs where there is a list of Java objects, from which selections can be made on a web form - usually you'd use the primary key ...

31. Recurring components in JSPs and Spring MVC    stackoverflow.com

I am building a Webapp with Spring MVC and on many different pages i would like to include something like a "smart" component. For example a box that shows various objects ...

32. Uploading file using Spring MVC and CommonsMultipartResolver not working as expected    stackoverflow.com

I am trying to upload files using Spring CommonsMultipartResolver however the controller is not recognised. I get this errror message: "The requested resource (/WebIDE/WEB-INF/views/file/upload.jsp) is not available." I have added commons-fileupload-1.2.2.jar and ...

33. How to host JSP pages on external web server for more dynamic editing using Spring MVC    stackoverflow.com

I would like to be able to deploy and manage a set of jsp files outside of the application and the server. We have a pain in the ... process ...

34. Multiple Select in Spring 3.0 MVC    stackoverflow.com

Ok so I've been trying to accomplish multiple selects in Spring MVC for a while and have had no luck. Basically what I have is a Skill class:

public class Skill {

35. spring jsp view problem    stackoverflow.com

there is 1 jsp page say view.jsp, so via spring it is rendered as view.htm, ok that is fine, but now i want to pass a list to it, and according ...

36. Where does the Spring Model that is passed to a JSP goes to?    stackoverflow.com

Ok, I'm lame, this is boring and newbie. But as I'm moving into JSP I decided to learn Spring too, because I wanted a good framework and I heard numberless people ...

37. map jsp in spring    stackoverflow.com

how to map jsp file in web folder ( not in web-inf folder) in spring?

38. how to organize & implement jsp file structure using Spring    stackoverflow.com

I'm a php programmer now doing a Java web project using Spring framework. I'm trying to organize my JSP files the way i would have organized my .tpl files in php. So ...

39. how to marshal object and return as a view (and not as JSP page) in spring + xstream    stackoverflow.com

I'm trying to follow this tutorial and build a RESTful service that can un/marshal an object to/from XML. http://www.stupidjavatricks.com/?p=54 The marshaller of choice in the article is xStream (I found it ...

40. Spring and dynamic inclusion of JSP files    stackoverflow.com

I'm starting building web apps in Spring 3 (and in J2EE) in general. Looking at the petclinic example I've seen that the programmer creates many JSP pieces, like header, includes, footer ...

41. Spring View Mapping Problem    stackoverflow.com

I've got a problem with my View Mapping in the Spring Web MVC. Dispatcher-servlet.xml:

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<context:component-scan base-package="de.bigbohne.smartmeter.controller" />

<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/views/"/>
My ...

42. spring app cant find mapping of my jsp index page    stackoverflow.com

i am having issues loading a simple index.jsp page using spring 3 and tomcat 7.0 the error i recieve from the tomcat logs is this:

2011-02-07 11:36:18,510 DEBUG [org.springframework.web.servlet.DispatcherServlet] -  

DispatcherServlet with ...

43. Problem with Spring MVC. How can I create view from two or more object?    stackoverflow.com

[spring 3.0.5] [jboss 5.1] A have a two class

public class User {
 private String name;
 private String surname;
 private Address address;
sets and gets 
setters and getters  

public class Address {
 private String ...

44. hashmap input in jsp    stackoverflow.com

can someone tell me how to set a hashmap value in jsp? The object is car with:

private Map<String, Float> myHashMap = new HashMap<String, Float>();
in the jsp i want do soemthing like this ...

45. Looking for a more concise JSP forwarding configuration in Spring 3.0    stackoverflow.com

In a normal Java weba app, if I put this in my servlet code the forwarding works:

getServletConfig().getServletContext().getRequestDispatcher("/something.jsp").forward(req, resp);
But when I do this in the same servlet in a Spring 3.0 app ...

46. Passing a model to an included JSP?    stackoverflow.com

Is there a way for me to pass my model to a JSP I include with a <script/> tag? I'm trying to create some dynamic javascript, and I need the model ...

47. Problem with combo component    stackoverflow.com

I have class representive a country COUNTRY CLASS

public class Country {
 private String countryCode;
 private String countryDescription;

public void setCountryDescription(String countryDescription) {
        this.countryDescription = countryDescription;

48. [spring][jsp] Problem with css file    stackoverflow.com

I have problem with .css file on my JSP page. My page looks like this:

<%@ page language="java" contentType="text/html; charset=UTF-8"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://www.springframework.org/tags" ...

49. Easy way for AXAX refresh JSP or Spring MVC page?    stackoverflow.com

This seems a bit like a rudimentary question for java web development but... How would I go about refreshing data in a JSP page? I mean, I get the basics (use jQuery ...

50. Can i use folder name in views jsp    stackoverflow.com

If i have folders in web-inf/jsp/person can i return this in controller

return "person/userpage"

51. Spring-mvc : serving JSP that was already statically included in another loaded jsp    stackoverflow.com

is this possible? I'm loading a JSP that statically includes a jsp fragment. Then I use ajax to reload only the jsp fragment, but I get

Caused by: org.apache.jasper.JasperException: Unable to ...

52. Why is my JSP view not being resolved?    stackoverflow.com

My dispatcher-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:p="http://www.springframework.org/schema/p"

53. spring mvc addAttribute to model, how to get it from jsp javascript    stackoverflow.com

i have a controller with a model which i do addAttribute("show", "yes"); how do I retrieve this value inside javascript?...assuming I have jstl

54. Dynamic navigation through multiple jsp pages    stackoverflow.com

I am developing web application using Spring 3.0, Hibernate and JSP pages as a view technology. And I am stuck on the problem of linking pages together. Here is the situation:
I do ...

55. JSP- getting array data into jsp from java    stackoverflow.com

I have to display data fetched from DB to JSP. I am using spring MVC. I have stored data in List in java. Now i need to access this list in ...

56. spring jsp error    stackoverflow.com

I am trying to make a simple login form with Spring MVC. I should say that I am new to this.The idea is that I am trying to validate the form ...

57. SpringMVC - JSP Iteration Issue    stackoverflow.com

I have the following class that I am attempting to use as a command object

public class Member {

   private String datePeriod;
   private String status;
   private ...

58. Spring MVC - AJAX-JSON Response to contain rendered JSP view    stackoverflow.com

I need my controller to return an AJAX JSON response that contains the updated HTML code. The updated HTML code is created by rendering a JSP view. For example: JSP:

JSON response:
{"columns" : "2", "rows":"1", ...

59. How to prevent raw exception information appearing on JSP in Spring MVC 3.0 app?    stackoverflow.com

While testing my Spring app, I uploaded a file that exceeded the maximum allowed size configured in the app. Consequently, the following message appeared on the JSP, visible to the user:

Exception: org.springframework.web.multipart.MultipartException: ...

60. spring mvc 3 populate javascript var from property file    stackoverflow.com

I need to populate a JavaScript variable with a property value (that defined in a property file) when page get loaded . i am using spring mvc 3. is there any ...

61. Spring 3 - InternalResourceViewResolver is not displaying my jsp page    stackoverflow.com

I am trying to make a sample Spring 3 Web Hello World sample but InternalResourceViewResolver is not displaying my jsp page? [B]web.xml[/B]

[CODE]<?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"

62. How can I configure spring mvc/jsp to output xhtml instead of html?    stackoverflow.com

I'm starting to experiment with Spring MVC, and noticed that my jsps are served as html files. E.g.


How can I configure Spring MVC to serve xhtml files instead?

63. What's the best method to use a configuration file?    stackoverflow.com

.properties? .xml? What is the best method to have a configuration in a website? In my case I need to have some variables, for example server_home = "http://site.com" site_name = "website's name" default_language = "en" images_folder = "/var/images/..." ...

64. Pass multiple values from java to jsp    stackoverflow.com

Hello I am trying to pass parameters from java to jsp file. But I am not getting it here is my code:

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

65. Select in Spring MVC by enum    stackoverflow.com

What is way to select enum from database? I have:

<select name="country">
  <c:forEach items="${countries}" var="value">
    <option value="${value}">${value}</option>
I have in class and table 'User' field string/varchar 'country' ...

66. Spring 3: map page.html to page.jsp    stackoverflow.com

I'm using Spring 3 and i don't know how to map somepage.htm to somepage.jsp without a controller. That is: if i go to somepage.htm, i want it to show me the jsp. ...

67. How can I get the spring error count in a JSP    stackoverflow.com

I am trying to do something conditionally in my JSP depending on if there are errors or not in my JSP, something like

    <c:when test="${errors.errorCount > 0}">

68. Spring cannot resolve JSP view    stackoverflow.com

I've got a Tomcat deployment with a single webapp living inside web/WEB-INF. Here is the way I'm instantiating the spring container:


69. How do you construct custom model and read them in jsp?    stackoverflow.com

Let's say that i have two tables :

Student (id,fistName,lastName,)
Discipline (id, name, mark)
student_discipline (student_id, discipline_id)
@Table(name = "STUDENTS")
public class Student {
    @Column(name ...

70. How to pass an object to the view Spring MVC3    stackoverflow.com

I have a simple test project in Spring 3, basically a method within the controller that fetches data from an arraylist and "should" pass them to a view Thsi is how the ...

71. spring framework file upload    stackoverflow.com

I'm working on a Java + Spring framework web application. I want to allow the user to upload a word document and/or pdf file to the system. There is MultipartResolver of ...

72. Excel parser JSP Spring    stackoverflow.com

I have been wondering if anyone could suggest me a good java Excel parser so I can upload and manipulate XLS files easily in spring. There are some parser on the ...

73. Pluggable pages in a Spring MVC application    stackoverflow.com

I'm developing a Spring application which needs to support pluggable modules - add the JAR to the classpath and it will automatically find and load the module's Spring application context XML. ...

74. Call javascript function on onChange event of an element loaded with Ajax in Spring MVC    stackoverflow.com

I have a drop down list with two values (for now..) with other elements in a form. What I'd like to do is enable four components if the user selects the ...

75. multiple instance of a same resolver in spring    stackoverflow.com

i have two view folder how can i manage a same resolver that can find a way to its resolver? i try this but this is not working

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/view/"></property>
<property ...

76. Why is the aliased Model object not accessible from a jsp include?    stackoverflow.com

I have a Model object ("foo") added to the ModelMap in the MVC controller: Spring MVC Controller:

Foo foo = new Foo("FooName");
model.addAttribute("foo", foo);
return "foo";
I can call properties of the object in foo.jsp. I ...

77. Spring MVC: How to get view-name in JSP?    stackoverflow.com

Is a way to access view name in JSP (profile in example below) or i need to add this name to model ?

@RequestMapping(value="/user/account", method=RequestMethod.GET)
    return "profile";

78. When using Spring, how do I print a stack trace in in my error 500 page?    stackoverflow.com


<%@ page isErrorPage="true" %>
<%@ page import="org.slf4j.Logger" %>
<%@ page import="org.slf4j.LoggerFactory" %>

<link rel="stylesheet" type="text/css" href="/scout/support/style.css"/>
<title>Scout 403 Error page</title>

79. Spring MVC not showing result in jsp    stackoverflow.com

I am new for Spring Framework. In my POC I am not getting the model value in jsp. below is my code My Controller is

public final class ContactController {


80. Spring View Resolvers - Overhead of using Resource Bundle View Resolver vs JSP pages    stackoverflow.com

In my application, I have both html and JSP files. I need them both to pass through the controller. But it is not possible to use multiple internalViewResolvers in an application . ...

81. Spring Mvc 3 hasErrors is always false    stackoverflow.com

I have following class,

public class MarketPlace {

    @NotEmpty(message="This Template Name is required")
    private String templateName;

    public String getTemplateName() ...

82. How to use multiple places in Spring viewresolver?    stackoverflow.com

this is how I define the loaction of my jsp files:

<bean id="jspViewResolver"
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />

83. JSP onclick event before passing the variable it updates in link    stackoverflow.com

I have a link in a jsp that looks like this:

<a href="link?var1=foo&var2=bar"target="_blank">text</a>
I have a form submit submitFormAsync('Form'); that sets a variable ${design.textVar} How can I set an onclick for this link to ...

84. How to get the selected value of combo in Spring MVC 3?    stackoverflow.com

I am using the Spring MVC <form:select> tag in my JSP and have populated the values in it. How can I retrieve the selected value from the select box and use it ...

85. Using ajax with Spring MVC    stackoverflow.com

I am currently using the Spring MVC, and I am trying to do some stuff with ajax. Basically what I want to do now is display the result from a controller ...

86. STS Spring MVC: How to include a JS file in a JSP    stackoverflow.com

I installed SpringSource Tool Suite 2.8.0. I'm trying to include a JS file in a JSP, using the Spring MVC template as a starting point. My JSP looks like this:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" ...

87. Spring MVC: Why do I need to (and how do I?) provide a mapping for a JSP view?    stackoverflow.com

I'm attempting to have a controller method return a ModelAndView object which uses a JSP as the view. The application context configuration for the ViewResolver:

<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">

88. Why can't I use empty HTML elements in Spring/JSP?    stackoverflow.com

Possible Duplicate:
How to produce valid HTML with JSPX? (not XHTML)
I've had a longstanding problem with the .jspx templates in a Spring Framework project I'm ...

89. Starting with SpringMVC    stackoverflow.com

I am planning to start developing a Web Application, it's my first contact with J2EE (i used to develop standard Java Applications), the problem is that i must use SpringMVC for ...

90. JSP include not working as expected    stackoverflow.com

I'm trying to include a dynamic jsp inside another jsp. Supposedly the output of the included jsp should appear within the parent jsp and I've tried this in other projects and ...

91. Spring null application context in JSP    stackoverflow.com

Am trying to get the application context in my JSP page. I have the following scriptlet in JSP.

       WebApplicationContext appCtx = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); 

92. Why can't I add to the model from a called method?    stackoverflow.com

When I do this:

@RequestMapping(value = "/something", method = RequestMethod.POST)
public String stuff(
    @ModelAttribute("xxx") ReviewAB7500Data xxx,
    HttpServletRequest request, Model model) throws GeneralDAOException {

93. How do I get sencha js and JSP to work together?    stackoverflow.com

I am looking into using Sencha touch to create the "view" portion of my webapp so that it will work on mobile devices. The web app is created using Spring MVC ...

94. JSP expression language not working    stackoverflow.com

I am not able to get ${} expression working on my .jsp page. displayAllCustomers.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

        <h3>Our Entire Customer ...

95. Spring MVC. Rendering layout    stackoverflow.com

I'am new to Java Spring MVC. Official documentation is very poor and i've got a lot of questions about rendering pages in Spring. I have page and top block with menu. ...

96. Spring MVC catch /* but not JSP    forum.springsource.org

Your configurations says, send all the requests to a servlet called dispacher-servlet.xml. What is the problem you are facing? is it a problem with a view resolver?

97. Spring MVC view layer: JSP vs Thymeleaf...    forum.springsource.org

98. Trouble with passing ModelAndView Object to JSP Page    forum.springsource.org

@RequestMapping("/login") public ModelAndView login() { LOGGER.info("Inside LOGIN"); Health health = null; health.setPasskey("abcd"); return new ModelAndView("/admin/login", "health",health); / }

99. JSP doesn't load attributes from model    forum.springsource.org

JSP doesn't load attributes from model I would dearly like to know what I'm missing here. Expressions in my JSP only seem to work when returning a ModelAndView. Controller: Code: @Controller ...

100. @ModelAttribute method not called on jsp:forward?    forum.springsource.org