You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel <da...@top-it.com.br> on 2004/03/24 13:52:33 UTC

html:javascript question

I want to put the msg inside a javasript alert (popup with error message ),some one know how can I make it ???????

<font color="red">

<html:messages id="msg" message="true" bundle="geral">

<bean:write name="msg" /><br>

</html:messages>

</font>


AW: html:javascript question

Posted by Andreas Solarik <a....@gesig.at>.
Well, I believe that you are not allowed to mix static and dynamic text
within a JSP, so something like

	alert("Error message: <bean:write name="msg"/>");

should fail. I read once that enclosing the dynamic text in single quotes
whould work (never tried it though). One solution that I do know is:

<snip>
<%
  String tempString="Error message: " + whateverBean.getWhatever();
%>

alert(<%= tempString %>);
</snip>

Its ugly, but it works. Anyone know of a more elegant solution? Note that
you need to get to the data contained in the bean you are writing from,
possibly with a request.getAtribute("attributeName");

Good luck,

Andreas


-----Ursprüngliche Nachricht-----
Von: Daniel [mailto:daniel@top-it.com.br]
Gesendet: Mittwoch, 24. März 2004 13:53
An: Struts Users Mailing List
Betreff: html:javascript question


I want to put the msg inside a javasript alert (popup with error
message ),some one know how can I make it ???????

<font color="red">

<html:messages id="msg" message="true" bundle="geral">

<bean:write name="msg" /><br>

</html:messages>

</font>



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