gpt4 book ai didi

java - Liferay portlet 中的自定义 servlet/jsp

转载 作者:行者123 更新时间:2023-11-30 06:35:26 25 4
gpt4 key购买 nike

我记得可以将类似这样的内容添加到 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

最佳答案

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

URL 将是 http://host:8080/cool-portlet/abcd/hw ....

如果您正在请求一个 servlet,'web-context' 目录名称必须跟在 ...

webapp/
cool-portlet/
ROOT/

关于java - Liferay portlet 中的自定义 servlet/jsp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6082061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com