Re: converting an existing web application into a portlet
"Patrick Huber" <[email protected]>
| Newsgroups | gmane.comp.jakarta.pluto.user |
|---|---|
| Message-ID | <[email protected]> |
Actually, It's the same as with servlets. You can very well do prints from the render method. There's no difference between prints or dispatching to a jsp. 2006/5/16, ChadDavis <[email protected]>: > So, I am guessing that the big stopping point would be if the > application doesn't properly separate the view from the controller, as > per the MVC. Seems like business logic mixed into the servlet, though > not good MVC, wouldn't muck up the port to portlets. But if the view > was mixed into the servlet, such as with println() generated html, it > might be sticky. > > On 5/15/06, Patrick Huber <[email protected]> wrote: > > I'd like to add, that you can't use html, head, body and such tags > > since you're only producing a fragment of a whole page. So you will > > have to change your jsp files there. > > > > The point about the forms is correct - they need to be posted to an > > action url. For creating links and encoding parameters in them see the > > portlet:actionURL and portlet:renderURL tags. These URLs are generated > > by the portlet container so that if you click on such a link, the > > portlet container knows which portlet it has to invoke. > > > > That's all I can think of for the moment... > > > > 2006/5/15, Brice Lambi <[email protected]>: > > > First thing is to create your portlet.xml file. Make an entry for each new > > > portlet. Be sure to use an example portlet.xml file as a template, it is a > > > little more complex than web.xml (you will also need a web.xml file, but it > > > doesn't need to contain any information about your portlets). You will need > > > to change every occurance of "Servlet" to "Portlet" in your source code. > > > Like getServletContext() -> getPortletContext(). The method calls are > > > almost exactly the same with the same result, so you should have little > > > trouble here. > > > > > > The PortletSession object is the only thing that I can think of that differs > > > slightly from it's servlet counter part. The setAttribute method has an > > > extra parameter for setting the scope. Check the jetspeed javadocs for more > > > info on that. > > > > > > If you have written your servlet to follow the concept that a http get > > > request handles display and a post request handles an action, you should be > > > able to rename doGet to doView and change the parameters from ServletRequest > > > and Response to RenderRequest and Response. Then change doPost to > > > processAction with ActionRequest and Response as the parameters. > > > > > > Some problems you might have: You cannot set the content type of a response > > > in a portlet. That is ulitmately set by the portal. You will not have a > > > PortletOuputStream to replace the ServletOutputStream. If you were using > > > http get to submit forms, that will probably not work. I believe that a > > > form needs to use the post method in order for the portal to actually call > > > your processAction method (that has been the case with some other portal > > > systems I have used). > > > > > > I'm sure I have forgotten something, but this should get you started. > > > > > > > > > -- > > "I love deadlines. I like the whooshing sound they make as they fly > > by." -- Douglas Adams > > > -- "I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams