<%@ page import="org.mule.module.client.MuleClient,
                 org.mule.api.MuleMessage"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>

<html>
<head>
<title>Mule Stock Quote Example</title>
</head>
<body>
<%
    String symbol = request.getParameter("symbol");
    if(symbol!=null) {
        MuleClient client = new MuleClient();
        MuleMessage message = client.send("vm://stockquote", symbol, null);

        if(message!=null) { %>
            <%if(message.getExceptionPayload()!=null) {%>
                <h3>A Error occurred: <%=message.getExceptionPayload()%></h3>
           <%} else {%>
                <h3><%=message.getPayload()%></h3>
           <%}%>
        <%} else {%>
           <h3>Message returned is null and no error information is available. Check the logs for more information. Note you need an internet connection to invoke this service.</h3>
       <%}
   }%>
Enter a stock symbol:
<form method="POST" name="submitSymbol" action="">
    <table>
        <tr><td>
            <input type="text" name="symbol"/></td><td><input type="submit" name="Go" value=" Go " />
        </td></tr>
    </table>
</form>
<p/>
<table border="1" bordercolor="#990000"  align="left">
<tr><td>For more information about the Stock Quote example go <a target="_blank" href="http://mule.mulesource.org/display/MULE2INTRO/Stock+Quote+Example">here</a>.</td></tr>
</table>
</body>
</html>
