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 9235785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:08:04+00:00 2026-06-18T07:08:04+00:00

i am using custom porltet in my liferay portal 6.i have some global variable

  • 0

i am using custom porltet in my liferay portal 6.i have some global variable that i want to use through out my portlet classes so for that i have written that variable in portlet.xml file as follows..

<init-param>
        <name>Host</name>
        <value>smtp.mail.yahoo.com</value>
</init-param>

<init-param>
        <name>Port</name>
        <value>465</value>
</init-param>

function which working perfect in my portlet action class

publicList<String> ReadSmtpDataForMailNotification() {

        List<String> ValuesListObj = new ArrayList<String>();
        ValuesListObj.add(this.getInitParameter("Host"));
        ValuesListObj.add(this.getInitParameter("Port"));
        return ValuesListObj;
    }

now problem is that when i excute the function withing the portlet action class then its working perfect but when i want to access this variable outside my portlet class..e.g :- in my local service impl class then i cant access that varible and the value come is always null..so please if anyone can suggest me how can i do get the value of initparam in other then portlet class.

@Advaita Gosvami

have written my.custom.host=liferay.css.com in portlet.properties file

and when i try to fetch value with the following

 System.out.println("Property value : - " + PropsUtil.get("my.custom.host"));

its giving me null value..

  • 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-18T07:08:05+00:00Added an answer on June 18, 2026 at 7:08 am

    Anyways I Have Done like this as @Advaita Gosvami told before with the changes in portlet.properties but some how it doesnt work with my custom key…

    mail.session.mail.smtps.auth=true
    mail.session.mail.smtps.host=smtp.gmail.com
    mail­.session.mail.smtps.password=***********(your password here)
    mail.session.mail.smtps.port=465
    mail.session.mail.s­mtps.user=liferay.test@gmail.com(your emailId Here)
    mail.session.mail.transport.protocol=smtp
    

    and i am calling it with

    PortletProps.get("mail.session.mail.smtps.host");
    

    its gave me perfect value from anywhere i call in my custom portlet

    Thanx @Advaita Gosvami for your valueble help.just in case u decalre custom key in portlet properties givng me null value.but with this keys as i have mentioned above in portlet properties i can access…thnx a lot

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

Sidebar

Related Questions

I have to use some JavaScript and CSS for my portlet. I am using
I have checked on Using custom services or liferay services in liferay themes (velocity
I'm using jsp of out-of-box portlet like feed.jspf in Liferay 6: String articleId =null;
When using custom css along with Twitter Bootstrap that overwrites some styles is it
I am using Liferay 6 for development , i have developed Liferay6 Struts2 Portlet
I am using my custom portlet in liferay. but somehow when i run my
I am using Liferay 6.1, Tomcat and MySQL. I have a custom-sql sentence for
i am using custom checkbox buttons in my table view and want to save
I'm using custom class that subclass from UILabel. It works fine unless I change
I have started using custom intents in my application and I have come across

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.