• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Struts error

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am new to tiles frame work

1. I have made the following entry in web.xml


<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>

2. I have made a layout jsp

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>

/tags/struts-tiles
<html>
<head>
<title>
<tiles:getAsString name="title" ignore="true"/>
</title>
</head>

<body marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 rightmargin=0>

<table cellpadding=0 cellspacing=0 height=100% width=100% border=1>

<tr>
<td height=90 colspan=2>
<tiles:insert attribute="header" ignore="true">
<tiles ut name="title" beanName="title" beanScope="title"/>
</tiles:insert>
</td>
</tr>

<tr>
<td width=150><tiles:insert attribute="left"/></td>
<td><tiles:insert attribute="content"/></td>
</tr>

<tr>
<td height=5 colspan=2><tiles:insert attribute="bottom"/></td>
</tr>

</table>

</body>
3. I have created the nessary files like footer,bottom etc.

4. My content.jsp is as below

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>

<html>
<head></head>
<body>
asdasd
<tiles:insert page="/msgtilelayout.jsp" flush="true">
<tiles ut name="title" type="string" value="QEqeqeqwe"/>
<tiles ut name="header" value="/header.jsp"/>
<tiles ut name="left" value="/left.jsp"/>
<tiles ut name="bottom" value="/bottom.jsp"/>
<tiles ut name="bottom" type="string">
Siome text goes here
</tiles ut>
</tiles:insert>
</body>
</head>

5. This is my entry in struts.config file
<plug-in className="org.apache.struts.tiles.TilesPlugin" >

<!-- Path to XML definition file -->
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<!-- Set Module-awareness to true -->
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true"/>
</plug-in>



But I am getting the following error

-------------------------------------

[#|2005-03-02T14:32:51.382+0530|SEVERE|sun-appserver-pe8.0.0_01|org.apache.stru ts.taglib.tiles.InsertTag|_ThreadID=11;|ServletException in '/msgtilelayout.jsp': Invalid bean scope null
javax.servlet.ServletException: Invalid bean scope null
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl .java:827)
at org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:69)
at org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:747)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.j ava:745)
at org.apache.jsp.msgtilelayout_jsp._jspService(msgtilelayout_jsp.java:123)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
--------------------------------------------------------

[#|2005-03-02T14:32:51.382+0530|SEVERE|sun-appserver-pe8.0.0_01|javax.enterpris e.system.container.web|_ThreadID=11;|StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: ServletException in '/msgtilelayout.jsp': Invalid bean scope null
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java: 921)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:460)
at org.apache.jsp.content_jsp._jspx_meth_tiles_insert_0(content_jsp.java:141)
at org.apache.jsp.content_jsp._jspService(content_jsp.java:80)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)

Thanks
Suneesh
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Suneesh VR",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we try to strictly enforce. Please re-read this document and edit your display name in order to comply. Thanks in advance, and we look forward to seeing you around the Ranch.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I think in your <tiles ut name =...>, you need to specify an actual beanScope as request, page,etc. Try it and see if that works.
 
Suneesh Raman
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried with bean scope also but still it is not working
When I am accessing the layout jsp I am getting the following error
will it be the problem ?


javax.servlet.ServletException: Error - tag.getAsString : component context is not defined. Check tag syntax
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:827)
org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:69)
org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:747)
java.security.AccessController.doPrivileged(Native Method)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:745)
org.apache.jsp.msgtilelayout_jsp._jspService(msgtilelayout_jsp.java:123)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:499)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)


root cause

javax.servlet.jsp.JspException: Error - tag.getAsString : component context is not defined. Check tag syntax
org.apache.struts.taglib.tiles.GetAttributeTag.doEndTag(GetAttributeTag.java:157)
org.apache.jsp.msgtilelayout_jsp._jspx_meth_tiles_getAsString_0(msgtilelayout_jsp.java:140)
org.apache.jsp.msgtilelayout_jsp._jspService(msgtilelayout_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:499)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you really need to do this ? For my case, I've always been using:



Originally posted by Suneesh VR:

<tiles:insert attribute="header" ignore="true">
<tiles ut name="title" beanName="title" beanScope="title"/>

 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic