Shivani Gupta
Shivani Gupta

Reputation: 31

how to call struts action from the jsp:include or tiles?

I have jsp, in which I want to include another jsp which is the forwarded result of struts action.

How I can include/insert using jsp:include/tiles insert or any other method? Any help would be appreciated.

Upvotes: 3

Views: 2496

Answers (1)

Naved
Naved

Reputation: 4118

If I understood your problem correctly. In your main JSP, You want to include a content which is a result of another action. I am not sure about jsp:include or tiles, but you can do this by using

  1. For that first you have to add your action to global forwards like
    name="beanIncFwd" path="/beanIncludeTest.do"
  2. Add action form corresponding ActionForm (for example name="beanIncForm")
  3. add the definition of action in action tag (for example I am using direct forward; you can use your own class here) path="/beanIncAction" and forward="/mypage.jsp"
  4. Add the required classes (i.e. Action and ActionForm)
  5. In your main JSP, write the following at the location where you want the included contents

    bean:include id="includePart" forward="beanIncFwd"/>
    bean:write name="includePart" filter="false"/>

Upvotes: 1

Related Questions