!--a11y-->
Executing a Servlet as Portal
Component 
Any servlet can be packed and executed as a portal component by packaging the servlet objects in a PAR file.
· Define a standard servlet class:

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServlet;
public class ServletTest extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) { try { resp.getWriter().write("I am a servlet"); } catch (Exception e) { } } } |
· In the PAR file declare that this object is a component of type servlet:

<components> <component name="ServletTest"> <component-config> <property name="ClassName" value="com.sapportals.portal.prt.component.ServletTest"/> <property name="ComponentType" value="servlet"/> </component-config> </component> |
· Package the servlet object in the PAR file:

<Portal Archive> | +-- META-INF +-- MANIFEST.MF +-- … +-- PORTAL-INF | | | +-- private | | +-- lib | | +-- servletTest.jar |
