I think the problem may be that the portlet engine is doing things
with the JSP under the hood that invalidate or confuse the GWT paths
you've put in i.e. it may not be producing HTML the way it looks in
view.jsp in reality. Note that a JSP gets compiled into a sevlet, and
a portlet is also a servlet so how does that work?. I'm not sure how
this is handled but there looks to be plenty of scope for problems to
creep in GWT-wise.
Have you tried using the Liferay "Hello world" portlet template in
exactly the same way Xantothara did, e.g.:
import com.liferay.portal.util.Constants;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
/**
* <a href="HelloWorldPortlet.java.html"><b><i>View Source</i></b></
a>
*
* @author Brian Wing Shun Chan
*
*/
public class YourGWTPortlet extends GenericPortlet {
public void processAction(ActionRequest req, ActionResponse res)
throws IOException, PortletException {
}
public void doView(RenderRequest req, RenderResponse res)
throws IOException, PortletException {
renderResponse.setContentType("text/html");
PrintWriter writer = renderResponse.getWriter();
writer.println("<script language='javascript' src='<
%=request.getContextPath()%>/com.cs.app.Hello.nocache.js'></
script>");
writer.println("Hello GWT:");
writer.println("<tr><td id="slot1"></td><td id="slot2"></td> </
tr> ");
writer.close();
}
}
I can't see why that would not work so long as
com.cs.app.Hello.nocache.js is in the right place. Note the XML
definition for this portlet does not have the
<init-param>
<name>view-jsp</name>
<value>/portlet/calendar/view.jsp</value>
</init-param>
tag in it, and I think this may solve your problem.
<portlet>
<portlet-name>47</portlet-name>
<display-name>Hello World</display-name>
<portlet-class>
com.foo.YouGWTPortlet <<<< put your portlet java class
here
</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>Hello World</title>
<short-title>Hello World</short-title>
<keywords>Hello World</keywords>
</portlet-info>
<security-role-ref>
<role-name>Power User</role-name>
</security-role-ref>
<security-role-ref>
<role-name>User</role-name>
</security-role-ref>
</portlet>
If it does work it looks like you could copy all the liferay
navigation/decoration stuff from the IFrame example if you need it:
http://content.liferay.com/4.0.0/docs/developers/ch08s01.html#d0e6445
Regards
Gregor