You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Just Fun 4 You <ju...@nexgo.de> on 2004/03/22 00:17:58 UTC

multiple lines in an ActionMessage object displayed via javascript alert

 
 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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


AW: AW: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Just Fun 4 You <ju...@nexgo.de>.
Hi Mark,

I got it solved. It is really a stupid mistake. In a string I have to put it
like  "\\nsomeText\\nAnotherText\\n". Now it works. Thanks for bearing it...


-----Ursprüngliche Nachricht-----
Von: Mark Lowe [mailto:mark.lowe@talk21.com] 
Gesendet: Montag, 22. März 2004 21:39
An: Struts Users Mailing List
Betreff: Re: AW: AW: AW: multiple lines in an ActionMessage object displayed
via javascript alert

send the whole rendered code with the \n's ..


On 22 Mar 2004, at 21:37, Just Fun 4 You wrote:

> I am pretty sure that this is a javascript issue. I am just wondering 
> why it all works when I remove the \n character. What does it make the 
> difference to javascript? Maybe others can jump in here. Again:
>
> having a string like "\nsomeText\nAnotherText\n" put in a 
> ActionMessage object causes a javascript error (unterminated string
constant).
> If I remove the \n character it works. When I code
> alert(\nsomeText\nAnotherText\n) directly into a html page, it also 
> works. I am not sure what really goes on here. I cannot see any 
> difference...
>
>
> -----Ursprüngliche Nachricht-----
> Von: Mark Lowe [mailto:mark.lowe@talk21.com]
> Gesendet: Montag, 22. März 2004 21:09
> An: Struts Users Mailing List
> Betreff: Re: AW: AW: multiple lines in an ActionMessage object 
> displayed via javascript alert
>
> Weird ..
>
> I thought it might be the accented characters but safari, msie mac and 
> firefox all work. And mise 6 on windoze.
>
> If the message gets to your page then its a javascript issue, but i 
> certainly cant recreate it.
>
> I assume that <logic:messagesPresent> </logic:messagesPresent> doesn't 
> appear in your rendered html..
>
>
>
> On 22 Mar 2004, at 20:45, Just Fun 4 You wrote:
>
>> Hi Mark,
>>
>> the properties file holds for critical.schedule.text:
>>
>> critical.schedule.text=Folgende Termine sind wg zeitlicher 
>> Überlastung für
>>
>>
>> The rendered jsp looks like this:
>>
>> ...
>>
>> 	<logic:messagesPresent>		
>> 		<script language="javascript">
>> 			
>> 		alert("Folgende Termine sind wg zeitlicher Überlastung für
> Schmidt
>> (SCHM05) kritisch:
>> 16.03.2004: 11 PS Tagesaufwand")
>> 		    			
>> 		</script>
>> 	</logic:messagesPresent>
>> ...
>>
>>
>> the following shows the source from the ActionClass:
>>
>>
>> ActionMessages messages = new ActionMessages();			
>> 				
>> String noteText = 	" " + person.getPersonDataShort() + " kritisch:\n";
>> 	
>> Iterator it = scheduleReportList.iterator();
>> 				
>> while(it.hasNext()){
>> 	Object object = it.next();
>> 					
>> 	if(object instanceof ScheduleModel){
>> 		ScheduleModel scheduleOversized = (ScheduleModel)object;
>> 						
>> 		noteText = noteText +
>> scheduleOversized.formatSqlDateToDate(scheduleOversized.getStartDate(
>> )
>> .
>> toStr
>> ing()) +
>> 		": " + scheduleOversized.getIntDailyManHour() + " PS
>> Tagesaufwand\n";						
>> 					}			
>> }	
>> 				
>> if(messages != null){
>> 	System.out.println("Note: " + noteText);	
>> 	messages.add(ActionMessages.GLOBAL_MESSAGE, new 
>> ActionMessage("critical.schedule.text", noteText.trim()));
>>
>> 				
>> 	saveMessages(request, messages);
>> }
>>
>>
>> thx,
>> Dirk
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Mark Lowe [mailto:mark.lowe@talk21.com]
>> Gesendet: Montag, 22. März 2004 18:25
>> An: Struts Users Mailing List
>> Betreff: Re: AW: multiple lines in an ActionMessage object displayed 
>> via javascript alert
>>
>> Whats actually in your properties file..?
>>
>> Paste the rendered source into the reply, i think its a javascript 
>> problem.
>>
>>
>>
>> On 22 Mar 2004, at 18:04, Just Fun 4 You wrote:
>>
>>> 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:mark.lowe@talk21.com]
>>> 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: 
>>>> struts-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: 
>>>> struts-user-help@jakarta.apache.org
>>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: AW: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Mark Lowe <ma...@talk21.com>.
send the whole rendered code with the \n's ..


On 22 Mar 2004, at 21:37, Just Fun 4 You wrote:

> I am pretty sure that this is a javascript issue. I am just wondering  
> why it
> all works when I remove the \n character. What does it make the  
> difference
> to javascript? Maybe others can jump in here. Again:
>
> having a string like "\nsomeText\nAnotherText\n" put in a ActionMessage
> object causes a javascript error (unterminated string constant).
> If I remove the \n character it works. When I code
> alert(\nsomeText\nAnotherText\n) directly into a html page, it also  
> works. I
> am not sure what really goes on here. I cannot see any difference...
>
>
> -----Ursprüngliche Nachricht-----
> Von: Mark Lowe [mailto:mark.lowe@talk21.com]
> Gesendet: Montag, 22. März 2004 21:09
> An: Struts Users Mailing List
> Betreff: Re: AW: AW: multiple lines in an ActionMessage object  
> displayed via
> javascript alert
>
> Weird ..
>
> I thought it might be the accented characters but safari, msie mac and
> firefox all work. And mise 6 on windoze.
>
> If the message gets to your page then its a javascript issue, but i
> certainly cant recreate it.
>
> I assume that <logic:messagesPresent> </logic:messagesPresent> doesn't
> appear in your rendered html..
>
>
>
> On 22 Mar 2004, at 20:45, Just Fun 4 You wrote:
>
>> Hi Mark,
>>
>> the properties file holds for critical.schedule.text:
>>
>> critical.schedule.text=Folgende Termine sind wg zeitlicher Überlastung
>> für
>>
>>
>> The rendered jsp looks like this:
>>
>> ...
>>
>> 	<logic:messagesPresent>		
>> 		<script language="javascript">
>> 			
>> 		alert("Folgende Termine sind wg zeitlicher Überlastung für
> Schmidt
>> (SCHM05) kritisch:
>> 16.03.2004: 11 PS Tagesaufwand")
>> 		    			
>> 		</script>
>> 	</logic:messagesPresent>
>> ...
>>
>>
>> the following shows the source from the ActionClass:
>>
>>
>> ActionMessages messages = new ActionMessages();			
>> 				
>> String noteText = 	" " + person.getPersonDataShort() + " kritisch:\n";
>> 	
>> Iterator it = scheduleReportList.iterator();
>> 				
>> while(it.hasNext()){
>> 	Object object = it.next();
>> 					
>> 	if(object instanceof ScheduleModel){
>> 		ScheduleModel scheduleOversized = (ScheduleModel)object;
>> 						
>> 		noteText = noteText +
>> scheduleOversized.formatSqlDateToDate(scheduleOversized.getStartDate() 
>> .
>> toStr
>> ing()) +
>> 		": " + scheduleOversized.getIntDailyManHour() + " PS
>> Tagesaufwand\n";						
>> 					}			
>> }	
>> 				
>> if(messages != null){
>> 	System.out.println("Note: " + noteText);	
>> 	messages.add(ActionMessages.GLOBAL_MESSAGE, new
>> ActionMessage("critical.schedule.text", noteText.trim()));
>>
>> 				
>> 	saveMessages(request, messages);
>> }
>>
>>
>> thx,
>> Dirk
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Mark Lowe [mailto:mark.lowe@talk21.com]
>> Gesendet: Montag, 22. März 2004 18:25
>> An: Struts Users Mailing List
>> Betreff: Re: AW: multiple lines in an ActionMessage object displayed
>> via javascript alert
>>
>> Whats actually in your properties file..?
>>
>> Paste the rendered source into the reply, i think its a javascript
>> problem.
>>
>>
>>
>> On 22 Mar 2004, at 18:04, Just Fun 4 You wrote:
>>
>>> 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:mark.lowe@talk21.com]
>>> 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: struts-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


AW: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Just Fun 4 You <ju...@nexgo.de>.
I am pretty sure that this is a javascript issue. I am just wondering why it
all works when I remove the \n character. What does it make the difference
to javascript? Maybe others can jump in here. Again:

having a string like "\nsomeText\nAnotherText\n" put in a ActionMessage
object causes a javascript error (unterminated string constant).
If I remove the \n character it works. When I code
alert(\nsomeText\nAnotherText\n) directly into a html page, it also works. I
am not sure what really goes on here. I cannot see any difference...
 

-----Ursprüngliche Nachricht-----
Von: Mark Lowe [mailto:mark.lowe@talk21.com] 
Gesendet: Montag, 22. März 2004 21:09
An: Struts Users Mailing List
Betreff: Re: AW: AW: multiple lines in an ActionMessage object displayed via
javascript alert

Weird ..

I thought it might be the accented characters but safari, msie mac and
firefox all work. And mise 6 on windoze.

If the message gets to your page then its a javascript issue, but i
certainly cant recreate it.

I assume that <logic:messagesPresent> </logic:messagesPresent> doesn't
appear in your rendered html..



On 22 Mar 2004, at 20:45, Just Fun 4 You wrote:

> Hi Mark,
>
> the properties file holds for critical.schedule.text:
>
> critical.schedule.text=Folgende Termine sind wg zeitlicher Überlastung 
> für
>
>
> The rendered jsp looks like this:
>
> ...
>
> 	<logic:messagesPresent>		
> 		<script language="javascript">
> 			
> 		alert("Folgende Termine sind wg zeitlicher Überlastung für
Schmidt 
> (SCHM05) kritisch:
> 16.03.2004: 11 PS Tagesaufwand")
> 		    			
> 		</script>
> 	</logic:messagesPresent>
> ...
>
>
> the following shows the source from the ActionClass:
>
>
> ActionMessages messages = new ActionMessages();			
> 				
> String noteText = 	" " + person.getPersonDataShort() + " kritisch:\n";
> 	
> Iterator it = scheduleReportList.iterator();
> 				
> while(it.hasNext()){
> 	Object object = it.next();
> 					
> 	if(object instanceof ScheduleModel){
> 		ScheduleModel scheduleOversized = (ScheduleModel)object;
> 						
> 		noteText = noteText +
> scheduleOversized.formatSqlDateToDate(scheduleOversized.getStartDate(). 
> toStr
> ing()) +
> 		": " + scheduleOversized.getIntDailyManHour() + " PS
> Tagesaufwand\n";						
> 					}			
> }	
> 				
> if(messages != null){
> 	System.out.println("Note: " + noteText);	
> 	messages.add(ActionMessages.GLOBAL_MESSAGE, new 
> ActionMessage("critical.schedule.text", noteText.trim()));
>
> 				
> 	saveMessages(request, messages);
> }
>
>
> thx,
> Dirk
>
>
> -----Ursprüngliche Nachricht-----
> Von: Mark Lowe [mailto:mark.lowe@talk21.com]
> Gesendet: Montag, 22. März 2004 18:25
> An: Struts Users Mailing List
> Betreff: Re: AW: multiple lines in an ActionMessage object displayed 
> via javascript alert
>
> Whats actually in your properties file..?
>
> Paste the rendered source into the reply, i think its a javascript 
> problem.
>
>
>
> On 22 Mar 2004, at 18:04, Just Fun 4 You wrote:
>
>> 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:mark.lowe@talk21.com]
>> 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: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Mark Lowe <ma...@talk21.com>.
Weird ..

I thought it might be the accented characters but safari, msie mac and  
firefox all work. And mise 6 on windoze.

If the message gets to your page then its a javascript issue, but i  
certainly cant recreate it.

I assume that <logic:messagesPresent> </logic:messagesPresent> doesn't  
appear in your rendered html..



On 22 Mar 2004, at 20:45, Just Fun 4 You wrote:

> Hi Mark,
>
> the properties file holds for critical.schedule.text:
>
> critical.schedule.text=Folgende Termine sind wg zeitlicher Überlastung  
> für
>
>
> The rendered jsp looks like this:
>
> ...
>
> 	<logic:messagesPresent>		
> 		<script language="javascript">
> 			
> 		alert("Folgende Termine sind wg zeitlicher Überlastung für
> Schmidt (SCHM05) kritisch:
> 16.03.2004: 11 PS Tagesaufwand")
> 		    			
> 		</script>
> 	</logic:messagesPresent>
> ...
>
>
> the following shows the source from the ActionClass:
>
>
> ActionMessages messages = new ActionMessages();			
> 				
> String noteText = 	" " + person.getPersonDataShort() + " kritisch:\n";
> 	
> Iterator it = scheduleReportList.iterator();
> 				
> while(it.hasNext()){
> 	Object object = it.next();
> 					
> 	if(object instanceof ScheduleModel){
> 		ScheduleModel scheduleOversized = (ScheduleModel)object;
> 						
> 		noteText = noteText +
> scheduleOversized.formatSqlDateToDate(scheduleOversized.getStartDate(). 
> toStr
> ing()) +
> 		": " + scheduleOversized.getIntDailyManHour() + " PS
> Tagesaufwand\n";						
> 					}			
> }	
> 				
> if(messages != null){
> 	System.out.println("Note: " + noteText);	
> 	messages.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionMessage("critical.schedule.text", noteText.trim()));
>
> 				
> 	saveMessages(request, messages);
> }
>
>
> thx,
> Dirk
>
>
> -----Ursprüngliche Nachricht-----
> Von: Mark Lowe [mailto:mark.lowe@talk21.com]
> Gesendet: Montag, 22. März 2004 18:25
> An: Struts Users Mailing List
> Betreff: Re: AW: multiple lines in an ActionMessage object displayed  
> via
> javascript alert
>
> Whats actually in your properties file..?
>
> Paste the rendered source into the reply, i think its a javascript  
> problem.
>
>
>
> On 22 Mar 2004, at 18:04, Just Fun 4 You wrote:
>
>> 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:mark.lowe@talk21.com]
>> 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: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by "Domingo A. Rodriguez S." <do...@yahoo.com>.
What if it could be solved by escaping again the '\' symbol?. Instead of
using '\n' use '\\n'.

 --- Just Fun 4 You <ju...@nexgo.de> escribió: > Hi Mark,
> 
> the properties file holds for critical.schedule.text:
> 
> critical.schedule.text=Folgende Termine sind wg zeitlicher Überlastung
> für
> 
> 
> The rendered jsp looks like this:
> 
> ...
> 
> 	<logic:messagesPresent>		
> 		<script language="javascript">
> 			
> 		alert("Folgende Termine sind wg zeitlicher Überlastung für
> Schmidt (SCHM05) kritisch:
> 16.03.2004: 11 PS Tagesaufwand")
> 		    			
> 		</script>
> 	</logic:messagesPresent>
> ...
> 
> 
> the following shows the source from the ActionClass:
> 
> 
> ActionMessages messages = new ActionMessages();			
> 				
> String noteText = 	" " + person.getPersonDataShort() + " kritisch:\n";
> 	
> Iterator it = scheduleReportList.iterator();
> 				
> while(it.hasNext()){
> 	Object object = it.next();
> 					
> 	if(object instanceof ScheduleModel){
> 		ScheduleModel scheduleOversized = (ScheduleModel)object;
> 						
> 		noteText = noteText +
>
scheduleOversized.formatSqlDateToDate(scheduleOversized.getStartDate().toStr
> ing()) +
> 		": " + scheduleOversized.getIntDailyManHour() + " PS
> Tagesaufwand\n";						
> 					}			
> }	
> 				
> if(messages != null){
> 	System.out.println("Note: " + noteText);	
> 	messages.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionMessage("critical.schedule.text", noteText.trim()));
> 
> 				
> 	saveMessages(request, messages);
> }
> 
> 
> thx,
> Dirk
>  
> 
> -----Ursprüngliche Nachricht-----
> Von: Mark Lowe [mailto:mark.lowe@talk21.com] 
> Gesendet: Montag, 22. März 2004 18:25
> An: Struts Users Mailing List
> Betreff: Re: AW: multiple lines in an ActionMessage object displayed via
> javascript alert
> 
> Whats actually in your properties file..?
> 
> Paste the rendered source into the reply, i think its a javascript
> problem.
> 
> 
> 
> On 22 Mar 2004, at 18:04, Just Fun 4 You wrote:
> 
> > 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:mark.lowe@talk21.com]
> > 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: struts-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>  

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


AW: AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Just Fun 4 You <ju...@nexgo.de>.
Hi Mark,

the properties file holds for critical.schedule.text:

critical.schedule.text=Folgende Termine sind wg zeitlicher Überlastung für


The rendered jsp looks like this:

...

	<logic:messagesPresent>		
		<script language="javascript">
			
		alert("Folgende Termine sind wg zeitlicher Überlastung für
Schmidt (SCHM05) kritisch:
16.03.2004: 11 PS Tagesaufwand")
		    			
		</script>
	</logic:messagesPresent>
...


the following shows the source from the ActionClass:


ActionMessages messages = new ActionMessages();			
				
String noteText = 	" " + person.getPersonDataShort() + " kritisch:\n";
	
Iterator it = scheduleReportList.iterator();
				
while(it.hasNext()){
	Object object = it.next();
					
	if(object instanceof ScheduleModel){
		ScheduleModel scheduleOversized = (ScheduleModel)object;
						
		noteText = noteText +
scheduleOversized.formatSqlDateToDate(scheduleOversized.getStartDate().toStr
ing()) +
		": " + scheduleOversized.getIntDailyManHour() + " PS
Tagesaufwand\n";						
					}			
}	
				
if(messages != null){
	System.out.println("Note: " + noteText);	
	messages.add(ActionMessages.GLOBAL_MESSAGE, new
ActionMessage("critical.schedule.text", noteText.trim()));

				
	saveMessages(request, messages);
}


thx,
Dirk
 

-----Ursprüngliche Nachricht-----
Von: Mark Lowe [mailto:mark.lowe@talk21.com] 
Gesendet: Montag, 22. März 2004 18:25
An: Struts Users Mailing List
Betreff: Re: AW: multiple lines in an ActionMessage object displayed via
javascript alert

Whats actually in your properties file..?

Paste the rendered source into the reply, i think its a javascript problem.



On 22 Mar 2004, at 18:04, Just Fun 4 You wrote:

> 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:mark.lowe@talk21.com]
> 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: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Mark Lowe <ma...@talk21.com>.
Whats actually in your properties file..?

Paste the rendered source into the reply, i think its a javascript 
problem.



On 22 Mar 2004, at 18:04, Just Fun 4 You wrote:

> 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:mark.lowe@talk21.com]
> 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: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


AW: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Just Fun 4 You <ju...@nexgo.de>.
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:mark.lowe@talk21.com] 
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: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: multiple lines in an ActionMessage object displayed via javascript alert

Posted by Mark Lowe <ma...@talk21.com>.
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: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org