Forums

Home » Liferay Portal » English » 3. Development »

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Franklin Phan
Why does portlet content disappear after adding servlet in web.xml??!
July 22, 2009 10:21 AM
Answer

Franklin Phan

Rank: Regular Member

Posts: 137

Join Date: March 10, 2009

Recent Posts

Why does the content disappear after creating a servlet?? Is this a bug? It's replicable!

Steps:
1. Use Plugins SDK to create a portlet
2. Use NetBeans 6.7 to open the portlet (File > New Project > Java Web Application with Existing Source; create nbbuild.xml)
2a. Right-click on the project node in the File or Project window, select Properties in the context menu, go to Libraries and add appropriate libraries (JSTL 1.1, Portlet 2.0 JSR 286, Liferay JARs, etc.)
3. Deploy to Liferay (build.xml > deploy)
4. Add the new portlet to Liferay portal using Add Application under the dock, and observe in the browser that the template portlet is deployed, showing the boiler-plate content:
Attachment

Attachments: before_adding_servlet.PNG (105.5k)
Franklin Phan
RE: Portlet contents disappear after adding servlet!
July 22, 2009 10:16 AM
Answer

Franklin Phan

Rank: Regular Member

Posts: 137

Join Date: March 10, 2009

Recent Posts

Steps Cont'd:
5. Create new servlet (right-click in appropriate file node and select New > Servlet in context menu; follow the steps, making sure to check Add information to deployment descriptor).
6. Observe modified web.xml (correct the web-app xmlns attributes for Tomcat 5.5.x):
Attachment

Attachments: adding_servlet.PNG (94.8k)
Franklin Phan
RE: Portlet contents disappear after adding servlet!
July 22, 2009 2:41 AM
Answer

Franklin Phan

Rank: Regular Member

Posts: 137

Join Date: March 10, 2009

Recent Posts

Steps Cont'd:
7. Deploy portlet (build.xml > deploy)
8. Refresh browser:
Attachment

Attachments: after_adding_servlet.PNG (106.6k)
Franklin Phan
RE: Why does portlet content disappear after adding servlet in web.xml??!
July 22, 2009 12:41 PM
Answer

Franklin Phan

Rank: Regular Member

Posts: 137

Join Date: March 10, 2009

Recent Posts

Discovered this to be caused by having a servlet name (<servlet-name> in web.xml) that matches the portlet name (<portlet-name> in portlet.xml).

Is this a feature or a bug? If bug, is it Liferay's? And why does it not get logged?