在Liferay的代码中追加一个Servlet,在WEB.xml配置后,在本地环境没有问题。
本地url: ·http://localhost:8080/urlpattern/?p1=xx
但放到服务器上后报找不到资源错误。
服务器URL: http://servername/urlpattern/?p1=xx
错误:"[PortalImpl:3812] Current URL /myservlet/ generates exception: null".
至于为啥报错,还没仔细研究liferay的代码。查找一下网上资料发现有人已经有同样的错误:Custom Servlet in web.xml
有人建议不要直接在Liferay的代码里面修改,而是在自己的portlet里面追加servlet的做法较好。
访问的时候把portlet名带上就ok了。