Discussion:
JSP page in the outbound
Narayanan Narayanan
2012-02-01 10:39:08 UTC
Permalink
I am a newbie to Mule Development.I want to display the result of my service in a jsp page(outbound endpoint).Can anybody tell me how to configure it.Can anybody give an example for that.Thanks

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Nahuel Lofeudo
2012-02-01 12:57:07 UTC
Permalink
Narayanan,

Take a look at the Bookstore example included in the Mule distribution. It uses JSPs to display the results of calls to Mule flows.

Best regards
Nahuel
MuleSoft Support
Post by Narayanan Narayanan
I am a newbie to Mule Development.I want to display the result of my service in a jsp page(outbound endpoint).Can anybody tell me how to configure it.Can anybody give an example for that.Thanks
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
KumarPonmaheswaran KumarPonmaheswaran
2012-02-02 04:34:27 UTC
Permalink
Thanks Naheul,

I have seen that Bookstore Example already,but i want the result jsp page to be given in the outbound endpoint of my component.How can i give that.Here is my config file.In the below index is the welcome page and will have liks to other jsp pages.In one of my jsp page if i click a submit button it has to open the result.jsp page(not by form action="result.jsp).

I want to know whether i can use two ports like this for the different services like below.

<ajax:connector name="ajaxServer" serverUrl="http://localhost:8087/index.jsp"
resourceBase="${app.home}/docroot" disableReplyTo="true"
/>

<flow name="Areausage">
<composite-source>
<!-- Incoming HTTP requests -->
<inbound-endpoint address="http://localhost:8886/areaConsolidation" transformer-refs="HttpRequestToNameString" exchange-pattern="request-response"/>
</composite-source>
<component class="org.mule.esb.smartmeter.Greeter"/>
<choice>
<when expression="payload instanceof org.mule.esb.smartmeter.NameString" evaluator="groovy">
<!-- <vm:outbound-endpoint path="chitchatter" exchange-pattern="request-response"/> -->
<http:outbound-endpoint address="_http://localhost:8087/result.jsp" method="POST" contentType="text/html" />
</when>
</choice>
</flow>

Thanks.
Narayanan

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Nahuel Lofeudo
2012-02-02 14:14:48 UTC
Permalink
Narayanan,
Post by KumarPonmaheswaran KumarPonmaheswaran
I have seen that Bookstore Example already,but i want the result jsp page to be given in the outbound endpoint of my component.How can i give that.Here is my config file.In the below index is the welcome page and will have liks to other jsp pages.In one of my jsp page if i click a submit button it has to open the result.jsp page(not by form action="result.jsp).
I think there is a confusion there.
Outbound endpoints (HTTP outbound endpoints in particular) call other services and wait for the other service's response.
In your case, if you put the URL for your JSP page in an outbound endpoint, Mule itself will call that JSP page, and return to the user whatever the JSP sends back.

User --request--> Mule --request------>\
JSP
User <--response-- Mule <--response--/

If you need the user's browser to hit the JSP, you can send back a HTTP redirect. Here's how to do it:
http://www.mulesoft.org/documentation/display/MULE3USER/HTTP+Transport+Reference#HTTPTransportReference-HandlingRedirects

Using redirects what happens is:

1) User --request--> Mule
User <-- redirect --/

2) User --request--> JSP

I hope that helps you in solving your problem.

Best regards
Nahuel
MuleSoft Support
Narayanan Narayanan
2012-02-03 04:00:41 UTC
Permalink
Thanks for your reply.
But no luck till now.

This is the error i am getting when i am trying to open result.jsp

*HTTP ERROR 404*
*Problem accessing /result. Reason:*

*NOT_FOUND*

This is my request:
<http:outbound-endpoint address="http://localhost:8086/result" method="GET" contentType="text/html" exchange-pattern="request-response" keep-alive="true" followRedirects="true" />


Do u have any idea about this.

<ajax:connector name="ajaxServer" serverUrl="http://localhost:8086/index"
resourceBase="${app.home}/docroot" disableReplyTo="true"
/>
It is not recognising all the jsp files in this docroot folder.Only index named file it is recognising.Can i use same 8086 port for both of these or anyhing to be changed.If i am giving connector ur and outbound endpoint address both as index then its opening the index page as expected.

Kindly give solution for this.

Thanks

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Nahuel Lofeudo
2012-02-06 22:43:46 UTC
Permalink
Post by Narayanan Narayanan
Thanks for your reply.
But no luck till now.
This is the error i am getting when i am trying to open result.jsp
*HTTP ERROR 404*
*Problem accessing /result. Reason:*
*NOT_FOUND*
<http:outbound-endpoint address="http://localhost:8086/result" method="GET" contentType="text/html" exchange-pattern="request-response" keep-alive="true" followRedirects="true" />
Are you sure you have either an inbound-endpoint or an HTTP server listening on that address? You should be able to hit it with a browser and get a response for Mule to be able to do so.
Post by Narayanan Narayanan
Do u have any idea about this.
<ajax:connector name="ajaxServer" serverUrl="http://localhost:8086/index"
resourceBase="${app.home}/docroot" disableReplyTo="true"
/>
It is not recognising all the jsp files in this docroot folder.Only index named file it is recognising.Can i use same 8086 port for both of these or anyhing to be changed.If i am giving connector ur and outbound endpoint address both as index then its opening the index page as expected.
The AJAX connector does not know how to render JSPs. Its purpose is to allow Javascript to send and receive data to and from Mule, most likely in JSON format.
You can serve static files through an AJAX connector, but it will treat JSPs as it would treat any other static file.
If you need to serve JSPs I'd recommend using a standard web container for that (e.g. Tcat or Tomcat), running Mule embedded in your application and letting the container's JSP engine do the JSP processing.

Best regards
Nahuel
MuleSoft Support
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...