Message Boards

example dosn't work

francesco viscomi, modified 6 Years ago.

example dosn't work

New Member Posts: 23 Join Date: 1/16/18 Recent Posts
Hi all,
i'm follow the following example:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-1/writing-the-my-greeting-portlet

but when i click on "Edit greeting", the page reload and i do not see nothing (only the view.jsp page); Besides no error is logged in any part;

I'm using:
Luna Release (4.4.0), with liferay plugin installed;
SDK: liferay-plugins-sdk-6.0.6-20110225
and
liferay-portal-tomcat-6.0.2

can someone help me to find out which one is the problem and where is it?

thanks
Francesco
thumbnail
Daniele Baggio, modified 6 Years ago.

RE: example dosn't work

Expert Posts: 336 Join Date: 12/5/08 Recent Posts
It's a very old liferay version...

If you share the code, we can try to understand the mistake.

@baxtheman
francesco viscomi, modified 6 Years ago.

RE: example dosn't work

New Member Posts: 23 Join Date: 1/16/18 Recent Posts
there are no java class, because everything is mamaged by MVCPortlet;

there are just two jsp page, the one is view.jsp and at the same level there is edit.jsp:
view.jsp
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ page import="javax.portlet.PortletPreferences" %>

<portlet:defineObjects />

<%
PortletPreferences prefs = renderRequest.getPreferences();
String greeting = (String) prefs.getValue("greeting",
"Hello! Welcome to our portal.");
%>

<p><%= greeting %></p>

<portlet:renderURL var="editGreetingURL">
<portlet:param name="mvcPath" value="/edit.jsp" />
</portlet:renderURL>

<p><a href="<%= editGreetingURL %>">Edit greeting</a></p>

and edit.jsp

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>

<%@ page import="javax.portlet.PortletPreferences" %>

<portlet:defineObjects />

<%
PortletPreferences prefs = renderRequest.getPreferences();
String greeting = renderRequest.getParameter("greeting");
if (greeting != null) {
prefs.setValue("greeting", greeting);
prefs.store();
%>

<p>Greeting saved successfully!</p>

<%
}
%>

<%
greeting = (String)prefs.getValue(
"greeting", "Hello! Welcome to our portal.");
%>

<portlet:renderURL var="editGreetingURL">
<portlet:param name="mvcPath" value="/edit.jsp" />
</portlet:renderURL>

<aui:form action="<%= editGreetingURL %>" method="post">
<aui:input label="greeting" name="greeting" type="text" value="<%=
greeting %>" />
<aui:button type="submit" />
</aui:form>

<portlet:renderURL var="viewGreetingURL">
<portlet:param name="mvcPath" value="/view.jsp" />
</portlet:renderURL>

<p><a href="<%= viewGreetingURL %>">&larr; Back</a></p>
thumbnail
Olaf Kock, modified 6 Years ago.

RE: example dosn't work

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Read on to the next chapter - then I'd assume it to work. See the last paragraph in this tutorial?

A warning about our newly created portlet: For the purpose of making our example easy to follow, we cheated a little bit. The portlet specification doesn’t allow setting preferences from a JSP, because they are executed in what is known as the render state. There are good reasons for this restriction, and they’re explained in the next section.


Another option is to continue with the current version, not with a version (6.0) that had its last release in 2011 and was superceded with the next version (6.1) in January 2012. Version 7.0 is current. Go with that.
francesco viscomi, modified 6 Years ago.

RE: example dosn't work

New Member Posts: 23 Join Date: 1/16/18 Recent Posts
I've used
liferay portal : liferay-portal-tomcat-6.2-ce-ga2-20140319114139101

ide liferay : liferay-ide-eclipse-windows-x64-2.2.4-ga5-201507230603

sdk : liferay-plugins-sdk-6.0.6-20110225

and it works
thnaks
thumbnail
Olaf Kock, modified 6 Years ago.

RE: example dosn't work

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Not sure if this makes a difference, but I wouldn't use the 6.0 plugins SDK with Liferay 6.2 - rather use matching versions (this is what made me think you were using 6.0).

Also, you might want to try the latest GA version of 6.2 if you're not using 7.0 - at least for a quick try. No need to hunt down long-fixed issues in versions that are out of date.
francesco viscomi, modified 6 Years ago.

RE: example dosn't work

New Member Posts: 23 Join Date: 1/16/18 Recent Posts
I need to use 5.2 liferay portal indeed, and i'm new to portlet container;

I don't know why but if i use sdk 6.2, it does not allow me to create a plugin project because there is something wrong with ivy;

Anyway i have to use maven as a building tool.

really thanks emoticon
Francesco
thumbnail
Olaf Kock, modified 6 Years ago.

RE: example dosn't work

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
francesco viscomi:
I need to use 5.2 liferay portal indeed, and i'm new to portlet container;

I don't know why but if i use sdk 6.2, it does not allow me to create a plugin project because there is something wrong with ivy;
...


Now you've got me completely confused: You're using plugins SDK from Liferay 6.0, state that you're running 6.2 but have to run 5.2. Then you're talking about Maven while you have problems with the Ant-based Plugins SDK that doesn't work because of Ivy? (Ant/Ivy is the only legit combination, as far as I remember my 6.2 setup)

I think it's time to start over: State which version you target, then try all of the environment from the same version. No mixing of different versions please. Assume I know no information that you stated above: What are the steps to reproduce your problem on that one explicitly named target version?
francesco viscomi, modified 6 Years ago.

RE: example dosn't work

New Member Posts: 23 Join Date: 1/16/18 Recent Posts
I've solved my original problem and thanks to you for your replay;
it 's ok;

I'm going to study liferay with maven at the moment
regards