Q: Using JRuby to Replace JSP in a Java EE Servlet Webapp I have been playing with the new torquebox (JBOSS) app server and like what I see so far however the ruby apps seem to be segregated from the java webapps. It is like they run in silos as separate webapps and blending them is obscure although I read that sessions can be shared... which is cool.
I have a conventional web-app built in Java EE Servlet JSP style and I want to be able to use ruby as my presentation layer logic instead of the JSP that is being used.
I should be able to run ruby resource from a web request context.  Much like apache mod_ruby kicks in to process rhtml... ( goal: get tomcat or JBoss to do this so trinidad or torquebox)
Example would be that I could replace HelloWorld.jsp ( that could call my java packages...)
with  HelloWorld.rhtml  or .rb?  and it could also call my java classes because it is JRuby...
As of now I can create RoR apps separate and sinatra but... I want ruby in the Java webapp not Java in the ruby webapp.
Does anyone know if what I am asking is currently possible with Torquebox or Trinidad?

A: You will still be stuck with JSP.
One option is to reuse JRuby's jar, but I doubt that will add much.

I have a conventional web-app built in Java EE Servlet JSP style and I
  want to be able to use ruby as my presentation layer logic instead of
  the JSP that is being used.

Not going to work.  Ruby is not used for presentation.  Rails framework allows erb.html that executes ruby, but that happens once when the page is loads.  The rest is mostly Rails Helpers/JQuery for presentation.
So, lets assume you got that working.  What are you going to do with those ruby variables?  I think it will lead to a dead-end, because there isn't much you can do with it with JSP.
The real question is what are you trying to do with Ruby that Java\JavaScript cannot do?  
For presentation I recommend you look into things that will help you code tags in a JSP friendly way.  Something like IceFaces.  With what you are suggesting to accomplish, you are limited to Expression Language.

A: you most certainly can do it but it needs a bit of exercise on your end to prepare things.
since you want it to be a Java web-app using Ruby and not a Ruby one using Java you simply add the jruby-complete.jar onto your CLASSPATH (assuming you do not need any gems you'll have stdlib - ERB is there). if you do need gems you can package up a gem.jar with Warbler.
than on the Java side you need to write an integration layer that will connect your MC with the V (for Ruby :)) ... e.g. in a controller when "rendering" you'll need to execute some Ruby code from Java one option is using the http://jruby.org/apidocs/org/jruby/embed/ScriptingContainer.html or you can (boot and) use the org.jruby.Ruby API directly.
than take the erb output and convert it to a Java string/io that should than end up as your response body ... of course this is a "conceptual" answer there will be a some (maybe a lot of) obstacles to solve along the road.
