Results 1 to 4 of 4

Thread: taking data to jsp from database through ModelAndView method

  1. #1
    Join Date
    Oct 2004
    Location
    INDIA
    Posts
    9

    Default taking data to jsp from database through ModelAndView method

    friends,

    i am doing a simple spring-hibernate application. i m using simple form controller. here i'm getting values from my DB.
    my aim is to print these values into a jsp.
    it is possible for me to print in another jsp
    {
    ...
    myModel.put("search",sresult);
    return new ModelAndView("hello","model",myModel);

    }

    but unfortunatenly unable to print into that same page from where i passed my query?
    hope for a good result

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    I don't quite understand the question.

    Is it possible for me to print in another jsp
    You want to execute those 2 lines of code in a JSP? If that's the question, you can't do because it subverts the MVC paradigm. A JSP should be chosen by the controller; a JSP or other view should regard the model as read only.

    Rgds
    Rod
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  3. #3
    Join Date
    Oct 2004
    Location
    INDIA
    Posts
    9

    Default how to use ModelAndView return.....

    Mr.Rod Johnson
    Thank you for your respose.here is my problem...

    i have to perform a search action. it have text box to get the name.according to that given data i have to get all corresponding value form the data base and have to disply it in the same page where my search button is.
    i hope u got me. what i have done is in my controller, the result from the database i put into a ""HashMap()"" object and it return with "" public ModelAndView onSubmit(Object command) throws ServletException "" . but in this case i am able to get those datas in a another jsp.
    waiting for ur reply,

  4. #4
    Join Date
    Aug 2004
    Location
    Vrhnika, Slovenia
    Posts
    133

    Default Form Controller

    If I understand you correct, you want to show the search form again, but with more information this time.
    This is really easy to do with SimpleFormController
    http://www.springframework.org/docs/...ler.html<br />
    , just determine when in method onSubmit() you want to call showForm() again.

    Rgds, Ales

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. PerformanceMonitorInterceptor
    By tnist in forum AOP
    Replies: 3
    Last Post: Aug 24th, 2005, 01:39 PM
  5. Replies: 1
    Last Post: Jul 28th, 2005, 05:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •