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

  • Home
  • SEARCH
  • 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 8359929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:18:27+00:00 2026-06-09T11:18:27+00:00

I have a portlet with a button in it. when this button clicked I

  • 0

I have a portlet with a button in it. when this button clicked I send an ajax request to one of my controller in my project and get back result in normal case I did it like this:

web.xml:

<servlet>
    <servlet-name>ctrl</servlet-name>
    <servlet-class>controller.Translator_ctrl</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>ctrl</servlet-name>
    <url-pattern>/translate</url-pattern>
</servlet-mapping>

view.jsp:

function send_form(){
            var xhr=new XMLHttpRequest();
            var base;
            var from=document.getElementById("from").value;
            var to=document.getElementById("to").value;
            var lang_from=document.getElementById("lang_from").value;
            var lang_to=document.getElementById("lang_to").value;
            //alert(":D:D:D"+from+"::::"+to+":::"+lang_from+":::"+lang_to);
            xhr.onreadystatechange=function (){
                if(xhr.readyState==4){
                    base=xhr.responseText;
                    //document.getElementById("to").value=base;
                    alert(base);
                }
            }
            xhr.open("GET","translate?mode=ajax&from="+from+"&to="+to+"&lang_from="+lang_from+"&lang_to="+lang_to,true);
            xhr.send();
        }

Now I do not know how to do it in Liferay? How can I do this in Liferay?

  • 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-09T11:18:28+00:00Added an answer on June 9, 2026 at 11:18 am

    utilize the “resource” lifecycle, which is there for exactly this purpose. You’ll send the request to and implement the serveResource method in your portlet (using whatever implementation/framework you use). The code that goes it there is basically the same as you had in the servlet when you didn’t use a portal environment

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this html: <div class=portlet-header> Company Information ... <button> some button here </button>
I have a Portlet controller like this. Here I bind a variable to Session.
I have configured one MULE application. I want this application to be a portlet
I have a portlet. Inside of this portlet I have Flex application that displays
Have a simple Spring MVC portlet, and from one of portal pages I have
I am newbie in liferay portal. I have developed one portlet in liferay for
I am currently working on a spring portlet mvc 3 project. I have a
I have html which looks somethine like this <div class=portlet portlet_30> <div class=portlet_header portlet_header_30>
I'm working to customize liferay's Calendar portlet and have created a hook for this.
I have the following HTML snippet <div id=column_1> <div id=portlet_1> <div id=portlet-header_1> <input type=button

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.