Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8133227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:32:33+00:00 2026-06-06T09:32:33+00:00

Hi i try do portlet from liferay documentation. But my java class dont work.

  • 0

Hi i try do portlet from liferay documentation. But my java class dont work.

MyGreetingPortlet

package com.liferay.samples;  
import java.io.IOException; 
import javax.portlet.ActionRequest; 
import javax.portlet.ActionResponse; 
import javax.portlet.PortletException; 
import javax.portlet.PortletPreferences; 
import com.liferay.util.bridges.mvc.MVCPortlet;  
public class MyGreetingPortlet extends MVCPortlet { @Override 
public void processAction( ActionRequest actionRequest, ActionResponse actionResponse) 
        throws IOException, PortletException { 
    PortletPreferences prefs = actionRequest.getPreferences(); 
    String greeting = actionRequest.getParameter("greeting");  
    if (greeting != null) { 
        prefs.setValue("greeting", greeting); 
        prefs.store();
        }  
    super.processAction(actionRequest, actionResponse); 
    } 
}

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="jspPage" value="/edit.jsp" /> 
</portlet:renderURL> 
<p><a href="<%= editGreetingURL %>">Edit greeting</a></p> 

edit.jsp

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> 
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %> 
<%@ page import="com.liferay.portal.kernel.util.Validator" %> 
<%@ page import="javax.portlet.PortletPreferences" %>  
<portlet:defineObjects />  
<% PortletPreferences prefs = renderRequest.getPreferences(); 
String greeting = (String)prefs.getValue( "greeting", "Hello! Welcome to our portal."); %>  
<portlet:actionURL var="editGreetingURL"> <portlet:param name="jspPage" value="/edit.jsp" /> 
</portlet:actionURL>  
<form action="<%= editGreetingURL %>" method="post"> 
<label><input type="text"><%= greeting %></label>
<input type="submit" name="submit" value="Submit">
</form>  
<portlet:renderURL var="viewGreetingURL"> 
<portlet:param name="jspPage" value="/view.jsp" /> 
</portlet:renderURL>  
<p><a href="<%= viewGreetingURL %>">&larr; Back</a></p>

After deploy jsp works fine, but when i click on Submit button nothing heppens. I change only one thing in this example: delete aui tags but dont think that chage something, couse im already try a few diffetent examples and no one works with java classes. Oh, and i use MVC portlets.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:32:35+00:00Added an answer on June 6, 2026 at 9:32 am

    I think your portlet-class in portlet.xml is not pointing to the custom portlet class of yours and is still referring MVCPortlet. Please change that to point your custom portlet class

    —Update—

    After checking your code in my local found that the way you are passing parameter is incorrect. You are not passing the name of the parameter. You should pass the parameter like shown below.

    <input type="text" name="<portlet:namespace/>greeting"><%= greeting %></input>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with portlet. When i write in portlet.xml standart line <portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
I try unsuccessful to access from my portlet the session attribute that I have
In Liferay 6.1 The class ServletResponseUtil has been moved to a different package than
I would like to query a portlet from a meteo service. But as my
I try to use Spring to develop liferay portlets (version 6.0.6), could i use
Try as I might I cannot get my head around what the IteratorIterator class
When i try to use spring 2.5.x DispatcherPortlet with liferay to use Ajax, i
I try to develop simple web service to liferay 6.1. I follow such manuals
Try the following sample code: <div style=background-color:#ddd> <div style=width:900px; margin:0px auto> <div class=row> <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.