hm. In my ActionClass I have something like this: ActionMessages messages = new ActionMessages(); String text = "\n: " + getCriticalDate.toString() + " -->";
text = text + getTotalHours() + " hours.\n"; messages.add("critical.schedule.text", text); saveMessages(request, messages); In my jsp: <logic:messagesPresent> <script language="javascript"> <html:messages id="message" message="true"> alert("<c:out value="${message}" />") </html:messages > </script> <logic:messagesPresent> This does not work: I get a javascript error (unterminated string constant). However everything works and the text is being displayed when I remove the \n from the text. the evaluated text string looks something like this if I print the text string to the console (seems ok): The following dates are critical: 20.03.2004: 5 hours. I want this format exactly being displayed using the alert function. I cannot see where the problem is. any idea? thx, Dirk -----Ursprüngliche Nachricht----- Von: Mark Lowe [mailto:[EMAIL PROTECTED] Gesendet: Montag, 22. März 2004 00:46 An: Struts Users Mailing List Betreff: Re: multiple lines in an ActionMessage object displayed via javascript alert What characters have you in your strings ? There must be something a quote or something give js a bad day. I assume you've something like this. msg1 = "<bean:message key="message1" />"; msg2 = "<bean:message key="message2" />"; msg3 = "<bean:message key="message3" />"; msg = msg1 +"\n"+ msg2 +"\n"+ msg3; alert(msg); Paste the rendered source in to a reply and I'm sure one or more of you messages has a character that needs escaping or something like that. On 22 Mar 2004, at 00:17, Just Fun 4 You wrote: > > Hi, > > I create an ActionMessages object and store one ActionMessage in it. > The > ActionMessage is a string which contains the \n character > to display the whole message in more than one line: > > message1\nmessage2\nmessage3... > > > In my jsp I have defined the html:message for iteration within a > javascript > block as I would like to display the message by the javascript alert > function. > > The problem is, that I always get a javascript error for the \n > character > (unterminated string constant). However, if I remove the \n character > everything works. But then, the whole message is displayed in one > line. Can > someone help? > > thx, > Dirk > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]