You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Werner Punz <we...@gmx.at> on 2005/08/13 22:31:39 UTC
weird message problem
Hi I am trying to add a simple error handler to a form with a message
upon an error condition, so far it works, some kind of message arrives
but I get a weird error, here are the relevant code snippets:
the part where the error is added:
ActionMessages errors = new ActionMessages();
errors.add("message", new ActionMessage("type mismatch failure"+detail));
super.saveMessages(request,errors);
ActionForward returnActionForward = mapping.findForward("failure");
return returnActionForward;
now the form code is like following:
<html:messages id="message" message="true" >
xxx
<li><bean:write name="message" /></li>
</html:messages>
and the failure forward set like following (and also triggered)
<action attribute="data" name="AssetDetailForm"
path="/assetDetailSubmit" scope="request"
type="com.sonydadc.claudio.struts.asset.actions.AssetDetailAction">
<forward name="success"
path="/WEB-INF/jsps/core/asset/Simpleone.jsp" />
<forward name="pubreqsuccess"
path="/WEB-INF/jsps/core/asset/PubRequestSuccess.jsp" />
<forward name="failure"
path="/WEB-INF/jsps/core/asset/AssetDetailMain.jsp" />
</action>
the funny thing is the code is triggered because if I remove the bean
write the xxx is called
but now I get following error:
Servlet.service() for servlet action threw exception
<javax.servlet.jsp.JspException: Cannot find bean message in any
scope>javax.servlet.jsp.JspException: Cannot find bean message in any scope
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:992)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:227)
at
org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspx_meth_bean_write_0(org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:642)
at
org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspService(org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:255)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
which means basically it has the message but the message bean itself is
not reachable thus the entire messaging system fails.
Does anyone know why this happens?
Werner
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: weird message problem
Posted by Werner Punz <we...@gmx.at>.
Laurie Harper wrote:
> Not everybody on this list is chained to their desk through the
> weekend... :-)
>
Well, yes good answer ;-)
> No, it means that it can't find a message resource with the key 'type
> mismatch failure...'. The argument to the ActionMessage constructor
> should be a resource key to look up in the message bundle. If you really
> want to pass a literal string instead of a resource key, you need to
> tell ActionMessage that:
>
> errors.add("message", new ActionMessage(
> "type mismatch failure"+detail, false));
>
a thanks that was it, works like a charme now, wonderful
thanks Laurie.
Werner
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: weird message problem
Posted by Laurie Harper <la...@holoweb.net>.
Werner Punz wrote:
> Come on, has nobody had this problem so far? I am really stuck here.
Not everybody on this list is chained to their desk through the weekend... :-)
>> the part where the error is added:
>> ActionMessages errors = new ActionMessages();
>> errors.add("message", new ActionMessage("type mismatch
>> failure"+detail));
...
>> but now I get following error:
>>
>> Servlet.service() for servlet action threw exception
>> <javax.servlet.jsp.JspException: Cannot find bean message in any
>> scope>javax.servlet.jsp.JspException: Cannot find bean message in any
>> scope
...
>> which means basically it has the message but the message bean itself
>> is not reachable thus the entire messaging system fails.
No, it means that it can't find a message resource with the key 'type
mismatch failure...'. The argument to the ActionMessage constructor should
be a resource key to look up in the message bundle. If you really want to
pass a literal string instead of a resource key, you need to tell
ActionMessage that:
errors.add("message", new ActionMessage(
"type mismatch failure"+detail, false));
L.
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: weird message problem
Posted by Werner Punz <we...@gmx.at>.
Come on, has nobody had this problem so far? I am really stuck here.
Werner
Werner Punz wrote:
> Hi I am trying to add a simple error handler to a form with a message
> upon an error condition, so far it works, some kind of message arrives
> but I get a weird error, here are the relevant code snippets:
>
>
> the part where the error is added:
> ActionMessages errors = new ActionMessages();
> errors.add("message", new ActionMessage("type mismatch
> failure"+detail));
>
>
> super.saveMessages(request,errors);
> ActionForward returnActionForward = mapping.findForward("failure");
> return returnActionForward;
>
> now the form code is like following:
>
> <html:messages id="message" message="true" >
> xxx
> <li><bean:write name="message" /></li>
> </html:messages>
>
>
> and the failure forward set like following (and also triggered)
> <action attribute="data" name="AssetDetailForm"
> path="/assetDetailSubmit" scope="request"
>
> type="com.sonydadc.claudio.struts.asset.actions.AssetDetailAction">
> <forward name="success"
> path="/WEB-INF/jsps/core/asset/Simpleone.jsp" />
> <forward name="pubreqsuccess"
> path="/WEB-INF/jsps/core/asset/PubRequestSuccess.jsp" />
>
> <forward name="failure"
> path="/WEB-INF/jsps/core/asset/AssetDetailMain.jsp" />
> </action>
>
>
> the funny thing is the code is triggered because if I remove the bean
> write the xxx is called
>
>
>
>
>
> but now I get following error:
>
> Servlet.service() for servlet action threw exception
> <javax.servlet.jsp.JspException: Cannot find bean message in any
> scope>javax.servlet.jsp.JspException: Cannot find bean message in any scope
> at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:992)
> at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:227)
> at
> org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspx_meth_bean_write_0(org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:642)
>
> at
> org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspService(org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:255)
>
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
>
>
> which means basically it has the message but the message bean itself is
> not reachable thus the entire messaging system fails.
>
> Does anyone know why this happens?
>
> Werner
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: weird message problem
Posted by Werner Punz <we...@gmx.at>.
thanks I will try it out, I knew it was something I must have missed
Werner
Albrecht Leiprecht wrote:
> Shouldn't it be something like
>
> <html:messages name="message"/>
>
> or
>
> <html:messages property="message"/>
>
> instead?
>
> Rgds albi
>
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Werner Punz
> Sent: Saturday, August 13, 2005 10:32 PM
> To: user@struts.apache.org
> Subject: weird message problem
>
> Hi I am trying to add a simple error handler to a form with a message
> upon an error condition, so far it works, some kind of message arrives
> but I get a weird error, here are the relevant code snippets:
>
>
> the part where the error is added:
> ActionMessages errors = new ActionMessages();
> errors.add("message", new ActionMessage("type mismatch
> failure"+detail));
>
>
> super.saveMessages(request,errors);
> ActionForward returnActionForward =
> mapping.findForward("failure");
> return returnActionForward;
>
> now the form code is like following:
>
> <html:messages id="message" message="true" >
> xxx
> <li><bean:write name="message" /></li>
> </html:messages>
>
>
> and the failure forward set like following (and also triggered)
> <action attribute="data" name="AssetDetailForm"
> path="/assetDetailSubmit" scope="request"
>
> type="com.sonydadc.claudio.struts.asset.actions.AssetDetailAction">
> <forward name="success"
> path="/WEB-INF/jsps/core/asset/Simpleone.jsp" />
> <forward name="pubreqsuccess"
> path="/WEB-INF/jsps/core/asset/PubRequestSuccess.jsp" />
>
> <forward name="failure"
> path="/WEB-INF/jsps/core/asset/AssetDetailMain.jsp" />
> </action>
>
>
> the funny thing is the code is triggered because if I remove the bean
> write the xxx is called
>
>
>
>
>
> but now I get following error:
>
> Servlet.service() for servlet action threw exception
> <javax.servlet.jsp.JspException: Cannot find bean message in any
> scope>javax.servlet.jsp.JspException: Cannot find bean message in any scope
> at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:992)
> at
> org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:227)
> at
> org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspx_meth_be
> an_write_0(org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:64
> 2)
> at
> org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspService(o
> rg.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:255)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
>
>
> which means basically it has the message but the message bean itself is
> not reachable thus the entire messaging system fails.
>
> Does anyone know why this happens?
>
> Werner
>
>
> ---------------------------------------------------------------------
> 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: weird message problem
Posted by Werner Punz <we...@gmx.at>.
Albrecht Leiprecht wrote:
> Shouldn't it be something like
>
> <html:messages name="message"/>
>
> or
>
> <html:messages property="message"/>
>
both caused the same weird error,
btw.. html:messages needs an enforced id flag according
to the tld.
Werner
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: weird message problem
Posted by Albrecht Leiprecht <al...@t-online.de>.
Shouldn't it be something like
<html:messages name="message"/>
or
<html:messages property="message"/>
instead?
Rgds albi
-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Werner Punz
Sent: Saturday, August 13, 2005 10:32 PM
To: user@struts.apache.org
Subject: weird message problem
Hi I am trying to add a simple error handler to a form with a message
upon an error condition, so far it works, some kind of message arrives
but I get a weird error, here are the relevant code snippets:
the part where the error is added:
ActionMessages errors = new ActionMessages();
errors.add("message", new ActionMessage("type mismatch
failure"+detail));
super.saveMessages(request,errors);
ActionForward returnActionForward =
mapping.findForward("failure");
return returnActionForward;
now the form code is like following:
<html:messages id="message" message="true" >
xxx
<li><bean:write name="message" /></li>
</html:messages>
and the failure forward set like following (and also triggered)
<action attribute="data" name="AssetDetailForm"
path="/assetDetailSubmit" scope="request"
type="com.sonydadc.claudio.struts.asset.actions.AssetDetailAction">
<forward name="success"
path="/WEB-INF/jsps/core/asset/Simpleone.jsp" />
<forward name="pubreqsuccess"
path="/WEB-INF/jsps/core/asset/PubRequestSuccess.jsp" />
<forward name="failure"
path="/WEB-INF/jsps/core/asset/AssetDetailMain.jsp" />
</action>
the funny thing is the code is triggered because if I remove the bean
write the xxx is called
but now I get following error:
Servlet.service() for servlet action threw exception
<javax.servlet.jsp.JspException: Cannot find bean message in any
scope>javax.servlet.jsp.JspException: Cannot find bean message in any scope
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:992)
at
org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:227)
at
org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspx_meth_be
an_write_0(org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:64
2)
at
org.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp._jspService(o
rg.apache.jsp.WEB_002dINF.jsps.core.asset.AssetDetailMain_jsp:255)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
which means basically it has the message but the message bean itself is
not reachable thus the entire messaging system fails.
Does anyone know why this happens?
Werner
---------------------------------------------------------------------
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