Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html:messages and bean:write 1

Status
Not open for further replies.

ukindian2001

Programmer
Jan 13, 2004
5
GB
hi friends,
im trying to use bean:write tag with htnl:messages.Im getting the following error
[Servlet Error]-[Cannot find bean message in any scope]: javax.servlet.jsp.JspException: Cannot find bean message in any scope

details:
code from my action class:-

ActionMessage message = new ActionMessage("invalid user name or password,Please try again");
messages.add("failedLogin",message);
if(!messages.isEmpty()){
saveMessages(request,messages);
}


and code from my jsp:-

<html:messages id=&quot;message&quot; property=&quot;failedLogin&quot;message=&quot;true&quot;>
<bean:write name=&quot;message&quot;/>
</html:messages>

please help me...i been looking my computer screen and dont know wat to do.. :(
 
&quot;You don't give the message text directly to ActionMessage. Instead you give a key to the Struts message resource file (also called &quot;the application property file&quot;).&quot;

In your struts application resource file:

invalid.login=invalid user name or password,Please try again

And in your action class where you create your action message:

ActionMessage message = new ActionMessage(&quot;invalid.login&quot;);

After you fix this, it should work as expected.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top