<%@ page import="org.apache.log4j.Logger" %>
<%@ page import="ro.emid.administrare.action.message.MessageService" %>
<%@ page import="ro.emid.common.mesg.Message" %>
<%@ page import="java.util.List" %>

<%
    final StringBuffer responseMessage = new StringBuffer();
    final List messages = (List) request.getAttribute("messages");

    responseMessage.append("[\n");
    if (null != messages) for (int i = 0; i < messages.size(); ++i) {
        final Message message = (Message) messages.get(i);

        if( i > 0) responseMessage.append(',');

        responseMessage.append('{')
                .append("\"id\": ").append(message.getId()).append(",")
                .append("\"type\": ").append(message.getType()).append(",")
                .append("\"message\": \"").append(message.getText())
        .append("\"}\n");
    }
    responseMessage.append("]\n");
%>

<respmesg>
    <%=responseMessage%>
</respmesg>

