You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Janice <ja...@shaw.ca> on 2004/04/21 20:03:57 UTC

flaky error: Error - tag.getAsString : component context is not defined

I've got a struts app in production and a couple users get this problem when
submitting a certain form.  The error appears to be about tiles, but that
just doesn't seem logical, since why wouldn't everybody be getting the
error?

Before I post the error message, etc, I should point out that the key to
these users getting this error would seem to be a few fields on the form
that are hidden unless they click on a link to show them.  The point being
is that they need to select a company and a contact person for the company.
The company is in a drop-down box and when a company is chosen, I populate
the contact drop-down box with the contacts for the selected company.  But
if the contact they want isn't there, they can click on a link that then
allows them to enter the contact's name, phone and email.  The contact
fields are conditionally validated upon submit for full name, proper
phone/email.

Like I say, it works most of the time, but the same 2 or 3 users keep
getting these problems.  If they don't use the fields to add a contact, the
form will submit fine.  If they do use the extra fields they get the error
as described...

The error message in the log is:
"
4/20/04 3:26 PM barts-web: Servlet error
javax.servlet.jsp.JspException: Error - tag.getAsString : component context
is not defined. Check tag syntax
	at
org.apache.struts.taglib.tiles.GetAttributeTag.doEndTag(GetAttributeTag.java
:198)
	at _jsp._layouts._layoutBase._jspService(_layoutBase.java:66)
	at com.orionserver[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
	at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
	at
oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
	at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.j
ava:721)
	at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDis
patcher.java:306)
	at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:
767)
	at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
	at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
	at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
va:803)
	at java.lang.Thread.run(Thread.java:479)
"

The error seems to be coming from the getAsString line in the layoutBase.jsp
page:
"<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-tiles.tld" prefix="tiles" %>

<html:html>
<head>
  <title>
    <tiles:getAsString name="title"/>
  </title>
...
"

My main tiles def'n is:
"  <definition name=".layout.base" path="/jsp/layouts/layoutBase.jsp">
    <put name="title" value="BARTS"/>
    <put name="header" value="/jsp/common/header.jsp"/>
    <put name="breadcrumb" value="/jsp/common/breadcrumb.jsp?bc="/>
    <put name="errorsAndMessages"
value="/jsp/common/errors_and_messages.jsp"/>
    <put name="nav" value="/jsp/common/menu.jsp"/>
    <put name="nav_void" value="/jsp/common/void.jsp"/>
    <put name="links" value="/jsp/common/links.jsp"/>
    <put name="service" value="/jsp/common/service.jsp"/>
    <put name="exit" value="/jsp/common/exit.jsp"/>
    <put name="footer" value="/jsp/common/footer.jsp"/>
    <put name="body" value="/jsp/body/sample.jsp"/>
  </definition>
"

And the def'n in question is (I think):
"
  <definition name=".projectForm" extends=".layout.base">
    <put name="title" value="BARTS - Project"/>
    <put name="body" value="/jsp/project/project_form.jsp"/>
    <put name="nav" value="/jsp/common/menu.jsp?current=project"/>
    <put name="breadcrumb"
value="/jsp/common/breadcrumb.jsp?bc=/projectSearch*showForm"/>
  </definition>
"

Could their operating systems have anything to do with this?  It was first
observed with users on NT boxes, but it just happened to one on XP.  They're
all using IE version 6ish.

Here's the bit of the .jsp page that shows the extra form fields:
(contactBlock is either "none" or "block"
"
	<!-- start of contact subform -->
	<tr class="body" bgcolor="<bean:message key="style.proj.colour1"/>">
		<td colspan="3" align="center">
			<table id="contactForm"
style="display:<%=contactBlock%>;" width="90%" border="0" cellspacing="0"
cellpadding="0">
				<tr>
					<td colspan="3"
class="body">&nbsp;</td>
				</tr>
				<tr class="body" bgcolor="<bean:message
key="style.proj.subformColour"/>">
					<td width="34%"><bean:message
key="person.firstName"/>:</td>
					<td width="3%">*</td>
					<td width="63%"><html:text
property="clientContactFirstNameText" size="20" maxlength="50" /></td>
				</tr>
				<tr class="body" bgcolor="<bean:message
key="style.proj.subformColour"/>">
					<td><bean:message
key="person.middleName"/>:</td>
					<td></td>
					<td><html:text
property="clientContactMiddleNameText" size="20" maxlength="50" /></td>
				</tr>        
				<tr class="body" bgcolor="<bean:message
key="style.proj.subformColour"/>">
					<td><bean:message
key="person.lastName"/>:</td>
					<td>*</td>
					<td><html:text
property="clientContactLastNameText" size="20" maxlength="50" /></td>
				</tr>        
				<tr class="body" bgcolor="<bean:message
key="style.proj.subformColour"/>">
					<td><bean:message
key="project.clientContactPhone"/>:</td>
					<td>*</td>
					<td><html:text
property="clientContactPhone" size="15" maxlength="25" />
            &nbsp;&nbsp;<span class="note"><bean:message
key="common.phoneFormat" /></span></td>
				</tr>        
				<tr class="body" bgcolor="<bean:message
key="style.proj.subformColour"/>">
					<td><bean:message
key="project.clientContactEmail"/>:</td>
					<td>*</td>
					<td><html:text
property="clientContactEmail" size="30" maxlength="50" /></td>
				</tr>        
				<tr>
					<td colspan="3"
class="body">&nbsp;</td>
				</tr>        
			</table>        
		</td>
	</tr> 
	<!-- end of contact subform -->  
"

If you made it to here, thanks.  If you have any ideas, please let me know.
I'm not sure how to go about this, since it has never failed for me here at
home on my development computer (XP).  The logs don't tell me anything more
than that stack dump.  I googled for the error I'm getting, but other folks
seem to get it when they're trying to implement tiles, not later on.

TIA,
Janice


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: flaky error: Error - tag.getAsString : component context is not defined

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Sorry, don't have an answer/solution for you, but I am left me wondering
what was the result of the action that ran? The tiles stuff is done at the
end, after the Action - so if your users submitted a form then did the
Action do its stuff OK and then fail forwarding to your tiles definition? If
so what do your struts-config,xml and tiles-defs.xml look like for that
forward?

I believe the TilesRequestProcessor sets the component context - is it
possible that whatever your users are clicking on is going straight to a jsp
and not going through an Action and therefore also not going through the
TilesRequestProcessor?

I would also go see (if possible) what exactly those users are doing,
perhaps they are doing their stuff in a way noone else is - in my experience
users at best miss out crucial information and at worst downright lie about
what they've done :-)

Niall

----- Original Message ----- 
From: "Janice" <ja...@shaw.ca>
To: <us...@struts.apache.org>
Sent: Wednesday, April 21, 2004 7:03 PM
Subject: flaky error: Error - tag.getAsString : component context is not
defined


> I've got a struts app in production and a couple users get this problem
when
> submitting a certain form.  The error appears to be about tiles, but that
> just doesn't seem logical, since why wouldn't everybody be getting the
> error?
>
> Before I post the error message, etc, I should point out that the key to
> these users getting this error would seem to be a few fields on the form
> that are hidden unless they click on a link to show them.  The point being
> is that they need to select a company and a contact person for the
company.
> The company is in a drop-down box and when a company is chosen, I populate
> the contact drop-down box with the contacts for the selected company.  But
> if the contact they want isn't there, they can click on a link that then
> allows them to enter the contact's name, phone and email.  The contact
> fields are conditionally validated upon submit for full name, proper
> phone/email.
>
> Like I say, it works most of the time, but the same 2 or 3 users keep
> getting these problems.  If they don't use the fields to add a contact,
the
> form will submit fine.  If they do use the extra fields they get the error
> as described...
>
> The error message in the log is:
> "
> 4/20/04 3:26 PM barts-web: Servlet error
> javax.servlet.jsp.JspException: Error - tag.getAsString : component
context
> is not defined. Check tag syntax
> at
>
org.apache.struts.taglib.tiles.GetAttributeTag.doEndTag(GetAttributeTag.java
> :198)
> at _jsp._layouts._layoutBase._jspService(_layoutBase.java:66)
> at com.orionserver[Oracle9iAS (9.0.3.0.0) Containers for
> J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
> at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
> at
> oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
> at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
>
J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.j
> ava:721)
> at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
>
J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDis
> patcher.java:306)
> at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
>
J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:
> 767)
> at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
> J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
> at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
> J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
> at
>
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
> va:803)
> at java.lang.Thread.run(Thread.java:479)
> "
>
> The error seems to be coming from the getAsString line in the
layoutBase.jsp
> page:
> "<%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/tld/struts-tiles.tld" prefix="tiles" %>
>
> <html:html>
> <head>
>   <title>
>     <tiles:getAsString name="title"/>
>   </title>
> ...
> "
>
> My main tiles def'n is:
> "  <definition name=".layout.base" path="/jsp/layouts/layoutBase.jsp">
>     <put name="title" value="BARTS"/>
>     <put name="header" value="/jsp/common/header.jsp"/>
>     <put name="breadcrumb" value="/jsp/common/breadcrumb.jsp?bc="/>
>     <put name="errorsAndMessages"
> value="/jsp/common/errors_and_messages.jsp"/>
>     <put name="nav" value="/jsp/common/menu.jsp"/>
>     <put name="nav_void" value="/jsp/common/void.jsp"/>
>     <put name="links" value="/jsp/common/links.jsp"/>
>     <put name="service" value="/jsp/common/service.jsp"/>
>     <put name="exit" value="/jsp/common/exit.jsp"/>
>     <put name="footer" value="/jsp/common/footer.jsp"/>
>     <put name="body" value="/jsp/body/sample.jsp"/>
>   </definition>
> "
>
> And the def'n in question is (I think):
> "
>   <definition name=".projectForm" extends=".layout.base">
>     <put name="title" value="BARTS - Project"/>
>     <put name="body" value="/jsp/project/project_form.jsp"/>
>     <put name="nav" value="/jsp/common/menu.jsp?current=project"/>
>     <put name="breadcrumb"
> value="/jsp/common/breadcrumb.jsp?bc=/projectSearch*showForm"/>
>   </definition>
> "
>
> Could their operating systems have anything to do with this?  It was first
> observed with users on NT boxes, but it just happened to one on XP.
They're
> all using IE version 6ish.
>
> Here's the bit of the .jsp page that shows the extra form fields:
> (contactBlock is either "none" or "block"
> "
> <!-- start of contact subform -->
> <tr class="body" bgcolor="<bean:message key="style.proj.colour1"/>">
> <td colspan="3" align="center">
> <table id="contactForm"
> style="display:<%=contactBlock%>;" width="90%" border="0" cellspacing="0"
> cellpadding="0">
> <tr>
> <td colspan="3"
> class="body">&nbsp;</td>
> </tr>
> <tr class="body" bgcolor="<bean:message
> key="style.proj.subformColour"/>">
> <td width="34%"><bean:message
> key="person.firstName"/>:</td>
> <td width="3%">*</td>
> <td width="63%"><html:text
> property="clientContactFirstNameText" size="20" maxlength="50" /></td>
> </tr>
> <tr class="body" bgcolor="<bean:message
> key="style.proj.subformColour"/>">
> <td><bean:message
> key="person.middleName"/>:</td>
> <td></td>
> <td><html:text
> property="clientContactMiddleNameText" size="20" maxlength="50" /></td>
> </tr>
> <tr class="body" bgcolor="<bean:message
> key="style.proj.subformColour"/>">
> <td><bean:message
> key="person.lastName"/>:</td>
> <td>*</td>
> <td><html:text
> property="clientContactLastNameText" size="20" maxlength="50" /></td>
> </tr>
> <tr class="body" bgcolor="<bean:message
> key="style.proj.subformColour"/>">
> <td><bean:message
> key="project.clientContactPhone"/>:</td>
> <td>*</td>
> <td><html:text
> property="clientContactPhone" size="15" maxlength="25" />
>             &nbsp;&nbsp;<span class="note"><bean:message
> key="common.phoneFormat" /></span></td>
> </tr>
> <tr class="body" bgcolor="<bean:message
> key="style.proj.subformColour"/>">
> <td><bean:message
> key="project.clientContactEmail"/>:</td>
> <td>*</td>
> <td><html:text
> property="clientContactEmail" size="30" maxlength="50" /></td>
> </tr>
> <tr>
> <td colspan="3"
> class="body">&nbsp;</td>
> </tr>
> </table>
> </td>
> </tr>
> <!-- end of contact subform -->
> "
>
> If you made it to here, thanks.  If you have any ideas, please let me
know.
> I'm not sure how to go about this, since it has never failed for me here
at
> home on my development computer (XP).  The logs don't tell me anything
more
> than that stack dump.  I googled for the error I'm getting, but other
folks
> seem to get it when they're trying to implement tiles, not later on.
>
> TIA,
> Janice
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: flaky error: Error - tag.getAsString : component context is not defined

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Thats good you sorted it out, and that you posted the cause/solution back to
the list.

We could do with some Wiki pages where people could record errors and their
cause/solution - kind of "knowledge base", I'm sure it would help alot of
people - it can be difficult to find these kinds of things from trawling the
list archvies.

Niall


----- Original Message ----- 
From: "Janice" <ja...@shaw.ca>
To: <us...@struts.apache.org>
Sent: Thursday, April 22, 2004 12:27 AM
Subject: RE: flaky error: Error - tag.getAsString : component context is not
defined


> Niall, thanks for your response.
>
> It would appear that this is the result of the user having javascript
> disabled on their browser.  Also, once we established that the users were
> not actually submitting their forms, but were getting the error as soon as
> they clicked on the link, it made it much easier to narrow down the
problem.
>
> This was the link:
> <a href="#" onclick="showhide('contactForm'); return(false);"><strong>Add
> Contact Form</strong></a></td>
>
> The onclick is being ignored, and the <a href="#"... Was getting called
> which was BAD.  It's the same result as if I did a right-click on the link
> and selected 'open in new browser'.
>
> So.. Not a struts issue at all.
>
> Cheers,
> Janice
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: flaky error: Error - tag.getAsString : component context is not defined

Posted by Janice <ja...@shaw.ca>.
Niall, thanks for your response.

It would appear that this is the result of the user having javascript
disabled on their browser.  Also, once we established that the users were
not actually submitting their forms, but were getting the error as soon as
they clicked on the link, it made it much easier to narrow down the problem.

This was the link:
<a href="#" onclick="showhide('contactForm'); return(false);"><strong>Add
Contact Form</strong></a></td>

The onclick is being ignored, and the <a href="#"... Was getting called
which was BAD.  It's the same result as if I did a right-click on the link
and selected 'open in new browser'.

So.. Not a struts issue at all.

Cheers,
Janice


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org