Announcement Announcement Module
Collapse
No announcement yet.
taking data to jsp from database through ModelAndView method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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,

      Comment


      • #4
        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

        Comment

        Working...
        X