Liferay portlet中的自定义servlet / jsp

时间:2011-05-21 13:32:45

标签: java jsp servlets portlet liferay

我记得可以在portlet的web.xml中添加这样的东西,可以在http://host:8080/abcd/hw到达jsp或servlet ....

<servlet>
    <servlet-name>myjsp</servlet-name>
    <jsp-file>/index.jsp</jsp-file>
    <init-param>
        <param-name>hello</param-name>
        <param-value>test</param-value>
    </init-param>
</servlet>
<servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>com.example.Servlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>myjsp</servlet-name>
    <url-pattern>/jsp/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/abcd/hw</url-pattern>
    <load-on-startup>1</load-on-startup>
</servlet-mapping>

但现在它有点解决了

INFO  [PortalImpl:4243] Current URL /abcd/hw generates exception: null

就像它被过滤掉了一样,但是在调试时我没有找到任何东西。

我在这里闻到了问题

13:48:58,587 DEBUG [ETagFilter:116] [http-8080-1]> com.liferay.portal.servlet.filters.etag.ETagFilter /web/guest/abcd/hw
13:48:58,588 DEBUG [I18nFilter:116] [http-8080-1]=> com.liferay.portal.servlet.filters.i18n.I18nFilter /web/guest/abcd/hw
13:48:58,588 DEBUG [SecureFilter:118] Access allowed for 127.0.0.1
13:48:58,589 DEBUG [SecureFilter:138] https is not required
13:48:58,589 DEBUG [SecureFilter:172] Not securing http://localhost:8080/web/guest/abcd/hw
13:48:58,590 DEBUG [SecureFilter:116] [http-8080-1]==> com.liferay.portal.servlet.filters.secure.SecureFilter /web/guest/abcd/hw
13:48:58,645 INFO  [PortalImpl:4437] Current URL /abcd/hw generates exception: null
13:48:58,646 DEBUG [SecureFilter:118] Access allowed for 127.0.0.1
13:48:58,647 DEBUG [SecureFilter:138] https is not required
13:48:58,647 DEBUG [SecureFilter:172] Not securing http://localhost:8080/c/portal/status
13:48:58,648 DEBUG [SecureFilter:116] [http-8080-1]===> com.liferay.portal.servlet.filters.secure.SecureFilter /c/portal/status
13:48:58,649 DEBUG [MainServlet:359] Process service request

1 个答案:

答案 0 :(得分:5)

您只有一条信息是您不知道的。

网址为http://host:8080/cool-portlet/abcd/hw ....

如果您要请求servlet,则“web-context”目录名必须遵循...

webapp/
    cool-portlet/
    ROOT/