At 3:24 PM -0400 4/14/05, Les Dunaway wrote:
Joe,

Thanks for looking at it. Yes, I am saving the errors - I cut it too short here's all the code

if(!ud.isUserExist(username)){
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("error.logon.invalid.user"));
log.debug("Invalid User: " + username + " Errors: " + errors.toString());
} else
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("error.logon.invalid.password"));
saveErrors(request,errors);


A common case here would be if you are returning a redirecting forward; in that case, the JSP would be drawn in response to a second HTTP request, and the saved errors would have been lost.

There have been some efforts to support session-scoped message saving in recent versions of Struts, but I must admit I'm not fully up to speed on the status or techniques.

If that's not it, I'm still puzzled:

<h:messages id="msg" message="false">
<b:write name="msg" />
</h:messages>
Log4j from above: 102383 [http-8084-Processor42] DEBUG us.glsi.base.LogonAction - Invalid User: ferd Errors: {org.apache.struts.action.GLOBAL_MESSAGE=[error.logon.invalid.user[]]} I'm getting "2005-04-14 07:31:14 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: Cannot find bean msg in any scope"



the code inside <h:messages> should never execute if there are no messages. Is it possible that you don't have the "h" prefix bound to any taglibrary? In that case, the JSP interpreter would ignore those tags but it wouldn't ignore their contents. Obviously you have "b" bound, or you wouldn't be getting any errors.


Joe




Les



Joe Germuska wrote:

At 8:03 AM -0400 4/14/05, Les Dunaway wrote:

What am I messing up?


In the code you included in your email, you were not saving the errors. If that's not just a copy/paste mistake, then there's your problem.


Joe

I am having problems with Struts 1.2.4 ActionMessage / ActionError.

I'm using a setup like recommended on the wiki

ActionMessages am = new ActionMessages();
am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( "not.authorized.for.account" ) );
saveErrors( request, am );



<html:messages id="msg" message="false"> <bean:write name="msg" /> </html:messages>

My code:

LogonAction:

ActionMessages errors = new ActionMessages();
if(!ud.isUserExist(username)){
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("error.logon.invalid.user"));
log.debug("Invalid User: " + username + " Errors: " + errors.toString());
Logon.jsp
<h:messages id="msg" message="false">
<b:write name="msg" />
</h:messages>
Log4j from above: 102383 [http-8084-Processor42] DEBUG us.glsi.base.LogonAction - Invalid User: ferd Errors: {org.apache.struts.action.GLOBAL_MESSAGE=[error.logon.invalid.user[]]} I'm getting "2005-04-14 07:31:14 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: Cannot find bean msg in any scope"


That says to me that the html:messages tag is seeing that there are messages (and
there are, I can see that in my log4j output) and then the bean:write tag isn't
seeing the msg bean that the messages tag should have created?? Right?



Les

------------------------------------------------------------------------
L.W.(Les) Dunaway
GL Services
770-974-4289 / 888-243-9886
<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
"Great minds discuss ideas. Average minds discuss events. Small minds discuss people." - Admiral Hyman Rickover
------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]





--

L.W.(Les) Dunaway
GL Services
770-974-4289 / 888-243-9886
<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
"Great minds discuss ideas. Average minds discuss events. Small minds discuss people." - Admiral Hyman Rickover


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex

Reply via email to