> -----Original Message----- > From: Yan Zhu [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 05, 2003 10:57 AM > To: Struts Users Mailing List > Subject: a couple of questions > > > > hey guys, > > using struts 1.1 beta 3 here with tomcat 4.1.18. > > pretty much a newbie with struts ... > > first of all, I am trying to use ActionError to create > some error messages during validation. is there anyway to > customize your error message instead of getting from the > resource file? sometimes my message content is dynamic. If I > wish to extend the original ActionError to implement this > feature, how would I go about it? seems a bit tough without > modifying original class.
One, possibly hokie way, of doing this would be to use parameters in your resources. For example, say your error resource is defined as foo.error=Don't ever {0} and then you can create an error as ActionError a = new ActionError("foo.error", "do that again."); the following JSP will display "Don't ever do that again". <html:errors property="foo.error"/> A limiting case of this would be where foo.error is defined as follows foo.error={0} This makes the *entire* text of foo.error dynamic. > > in the resource file, you can specify error.perfix etc, > but you can't do this hiarchinally i suppose? it'd be much > nicer if for error.login, you can define error.login.prefix, > that way your error messages will look different based on > different types of errors. if this can't be done, might be a > good improvment in the future. > > I am also using tiles, which is a cool feature, but here > is my problem. I have a template with tile insert a few other > files, let's call them a.jsp and b.jsp. How do I do jsp > import or other things on a template level so I don't have to > do it over and over again for a.jsp and b.sjp. > > for example, I like to be able to include a init.jsp in > my template, so that I don't need to include one for a.jsp > and b.jsp individually. I tried it, doesn't seem to work. I have a root page layout tile that is something like: <%@ include file="header.jsp" %> <table....> . . <tiles:insert attribute="nav"/> . . <tiles:insert attribute="body"/> . . </table> My individual tiles extend the layout tile. The extensions in turn specify the actual the values for the 'title' and 'body' attributes. However, I don't have to repeat 'header.jsp'. > > thanks in advance. > > yan > > Sri -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>