aspose file tools*
The moose likes Struts and the fly likes Getting error in including JSP file into other JSP file in STRUTS Application?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting error in including JSP file into other JSP file in STRUTS Application??" Watch "Getting error in including JSP file into other JSP file in STRUTS Application??" New topic
Author

Getting error in including JSP file into other JSP file in STRUTS Application??

Pras Tiwari
Ranch Hand

Joined: Nov 07, 2005
Posts: 186
Hi,

I have two jsp pages. MemberLogin.jsp & viewcart.jsp.
In memberLogin.jsp I want to include viewcart.jsp. I have one action class into my application as "viewcartAction.java" & corresponding formbean as "viecartForm.java" with action having forward value "viewcart" with scope request, which is forwarding to Viewcart.jsp. On Viewcart.jsp page I can display all values from formbean "viewcartform.java" when I am typing in browser as path "viewcart.do". But when I am trying to include this viewcart.jsp file into Memberlogin.jsp, I am getting followin error:-
=================================
javax.servlet.ServletException: Cannot find bean viewcartForm in any scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.jsp.MemberLogin_jsp._jspService(org.apache.jsp.jsp.MemberLogin_jsp:556)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
===================================

How to solve this??
What I should do if I want to include viewcart.jsp(which is taking values from its own actioncalss & formbean) into MemberLogin.jsp??

Please tell me.

Thanx in advance.
Prash


********Deserve Before You Desire********
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It's not Viewcart.jsp that you want to include, it's viewCart.do. The viewCart action instantiates the form bean, so if you don't call the action before displaying the JSP, you'll get the message that the form bean doesn't exist.

I'd also use a <jsp:include> rather than <%@ include file="" %>. This ensures that the page gets processed as if it were a separate page before being included in your login page.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting error in including JSP file into other JSP file in STRUTS Application??
 
Similar Threads
Cant Access contents of form in forms Action class...
Action Form Problem
html select box - values getting lost
request problems
How to include contents of a JSP into other JSP file?