Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to include contents of a JSP into other JSP file?

 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my STRUTS Based web application there are two files Viewcart.jsp & MemberLogin.jsp. Now ViewCart.JSP file has formbean & Action Associated with it. & when I am trying to access contents of ViewCart.jsp through typing in browser address bar "viewcart.do" I can view All the contents of viewcart.JSP Successfully. Now My MemberLogin.jsp Has also its own formbean & action class. Now I want to include Viewcart.jsp into my MemberLogin.jsp
I tried with following code into body of my MemberLogin.jsp:-
==============
<jsp:include action="/viewcart" />
==============

But couldn't succeed.
How should I solve above problem?
Can I use type of "viewcart" action as "org.apache.struts.IncludeAction"?
If yes then how? Is there any other solution to this?

Please tell me .
Thanx in advance.
Prash
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your're going to use the jsp:include tag, the syntax would be:

<jsp:include page="viewcart.do" /> The jsp:include tag is a standard JSP tag and doesn't know anything about Struts actions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic