• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting bean property values using jstl in jsp page

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am a Spring newbie and have the assignment to explore a framework in about 10 days for my Java certification. My choice was Spring which was not the easiest choice i think.
Because i also have to show a working demo, i try to build the application simultaneous my theory reading. So already my apologies if i am making wrong statements, use incorrect terms, etc.

I currently have build a simple application with one controller. The application allows the user to fill in a complaint, enter the way he/she wants to get informed about the process and finally receives a initial e-mail or sms depending on the entered choice. The application uses the following bean in the applicationContext.xml to select the valid class for sending the message.



In the klachtView.jsp (welcome page) shown below i want to list the key values of the klachtService bean defined in applicationContext.xml. If this is possible, what should i to correct this, because currently this gives an 'Neither BindingResult nor plain target object for bean name 'klachtService' available as request attribute' at line 84 where the bind is done.

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anything you want to display in a jsp page, you just have to include it into the Model that you make/return from your controller. It can be anything. But unless it is in your model or HttpSession or other Web objects, then you won't have access to it. The Web page has no idea about your Application Context, nor should it.

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

Thanks for the reply. I did know that it had to be in the model somehow, like using any other servlet. But had no clue how to implement it in a Spring 2 framework application. In my controller i only had the onSubmit method, the only method i had worked with. This method is not executed when the initial get of the page is done. I finally found the formBackingObject method wherein i create a new instance of my object. I add some default property values here by reading the properties of bean defined in my applicationContext.xml.


Cheers,
Peter


 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic