Announcement Announcement Module
Collapse
No announcement yet.
method call at jsp page beginning Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • method call at jsp page beginning

    Hi,
    Kindly clarify the below doubts.
    I have main Page (say parentPage.jsp) which includes the second page called childPage.jsp.All the values to be displayed in parentPage.jsp are fetched from the db(put in map) and i returned the pagename(parentPage.jsp) and map from my controller.While including the second page is there any chance to call another methods without submitting the page.

    ie.. any possiblity to call method at the beginning of the page after include

  • #2
    Well not sure if you REALLY want to call a method from a jsp... You should setup all the data needed in your page in your Controller. So you should extend your controller...

    Comment


    • #3
      From your short description, I'm not really sure this is what you are looking for, but it makes me think of Tiles and Tiles View Preparer. Tiles preparer are used to load data for specific template part. There is some integration with spring available.

      Comment


      • #4
        Hi,
        Here is my clear explanation ,

        ParentPage.jsp :

        <!-- Some data to be displayed -->
        <include childpage.jsp>
        <!-- footer inlcude -->

        Controller :

        public ModelAndView redirect(Object command)throws Exception
        {

        return new ModelAndView("ParentPage.jsp");
        }

        Now the above method redirect to ParentPage.jsp.While including the childpage.jsp,i have to call another method to get some data from db without submitting the page.

        Comment


        • #5
          Your controller does nothing except redirecting to the view ? Why dont you load data for your "childpage.jsp" in that controller ? Is it because "childpage.jsp" is included in many places and you want to factorize the code ? In that case, you should definitely have a look at tiles and tiles-preparers.

          Comment

          Working...
          X