Allen,
Thanks for your reply. Right now, I am lookign at something from apache: http://portals.apache.org/jetspeed-2/multiproject/portals-bridges-struts/index.html
Its a struts-portal bridge and is supposed to automate all that is required, so that most struts web applications can run in a portal with minor modifications.
Check it out. Will post what I find.
Regards, Karan
Fogleson, Allen wrote:
Karan,
The problem is you are submitting to struts. About a year and a half ago we had this same problem. We had legacy apps running that the client wanted to display inside a portal.
The major portal vendors and J2EE portal vendors (bea etc) all have solutions to do this that you can purchase. They all do basically the same thing:
1) Proxy the request to the legacy app (in your case your struts app) 2) rewrite any link to redirect through the portal and the proxy. 3) display the new markup.
We did not want to purchase, or rather I should say the client did not, a commercial solution so we were faced with having to write our own proxy.
It is relatively easy for HTML. The problem really comes in when you are dealing with javascript. For instance you would have to parse location.href='myaction.do?param1=true'
Into something like: Location.href='portal/proxyPortlet?url=myaction.do?param1=true
There are so many ways that javascript can change the page that it becomes extremely painful to do all this. We actually looked at grabbing Mozilla's javascript parsing engine and modifying it to do what we wanted. Writing this proxy (of course now it has been sold and I cant even release the code... too bad since it would be extremely useful to me now :) actually took up about 2/3 of our project time.
Unfortunately there is no "elegant" solution that I know of to your problem, just a brute force way. Essentially you cannot submit to the struts controller directly, as it will do exactly as you say, you must go through the portal controller so it can "portletize" your app.
The html part of it is relatively easy to do. Use an HTML client to get the page text... parse the text and replace all the links in it. Display the parsed text. It's the javascript side as I said that will kill you.
Of course the nice thing is once it is written it can be used for ANY external app :)
Al
p.s. if ANYONE has a nice elegant solution to this I'd love to hear about it :) maybe a JSR168 struts portlet? :)
-----Original Message----- From: Karan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 16, 2005 11:07 AM To: ML Struts Subject: Struts Portlets, jBoss Portal
Has anyone transferred their Struts application to run as a JSR168 portet in jBoss Portal?? I am using jBossAS 4.0.1sp1 and jBoss Portal v2.0.
Whats confusing me is this: In struts, every action defines the html/jsp/freemarker etc page that should be displayed. on the user's screen. However, to display something in a portlet, it should be called inside the doView() function of the portlet,
This statement is in the doView() function of my portlet's class: ...... PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/main.do"); ......
My struts-config: .... <action path="/main" type="portlet.mote.beans.MainAction"> <forward name="success" path="/FTLs/main.ftl"/> </action> <action path="/trial" forward="/FTLs/trial.ftl"/> .....
The above scenario displays the content of main.ftl in the portlet's window, just like it should, i.e. the portlet called main.do, and whatever main.do returns (main.ftl) is sent to the portlet to be displayed. But, when I put a link in main.ftl which points to another action, (say, trial.do): My main.ftl: <#assign html=JspTaglibs["/WEB-INF/struts-html.tld"]> <#assign bean=JspTaglibs["/WEB-INF/struts-bean.tld"]> This is main.ftl in stack2.war. If you see this, it means basic Struts action-mapping is working. <p><@html.link action="trial.do">Show Trial</@html.link></p>
When I click on the "Show Trial" link on main.ftl, the application leaves the portal and shows the content of trial.ftl on the browser (no portal/portlets, just trial.ftl). How do I make sure that whatever I do in struts stays inside the portlet
window?
Regards, Karan -- CM II Resolution Systems Inc. /-- never compromise. what if you compromise and lose? --/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
.
-- CM II Resolution Systems Inc. /-- never compromise. what if you compromise and lose? --/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]