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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:00:24+00:00 2026-06-09T22:00:24+00:00

I am developing Liferay portlet. The portlet should load xml file from same server

  • 0

I am developing Liferay portlet. The portlet should load xml file from same server as Liferay and then via ajax parse this xml and pass these values to jQuery. I started with html file to test the functionality only. So far everything works but when I put html and js code to portlet then jQuery works but I cannot load file. I would like to have xml file located at /etc/config_files/settings.xml

Here is part of jQuery my script

function getToolContent(tool){
     var layer = '.links_' + tool.toLowerCase();
     $(layer).text("");

     $.ajax({
        type:"GET",
        url: "/etc/config_files/settings.xml",
        dataType: "xml",
        success: function(xml){
               $(xml).find("tool").each(function() {              
                   if($(this).find('section').text() == tool){
                     var title = $(this).find('title').text();
                     var text = $(this).find('text').text();

                     $(this).find("link").each(function() {
                        var label = $(this).find('label').text();
                        var referer = $(this).find('referer').text();

                        $(layer).append('<a href="' + referer + '" class="formatted_link" alt="'+ tool + ' link">'+ label +'</a><br>'); 
                     });
                     $("#text").html('<h2>'+ title + '</h2>' +'\n'+ text);

                   }
               });
           }
     });
  }

and here is sample of xml file

<?xml version="1.0" encoding="UTF-8"?>
<descriptions>
   <tool>
      <section>TOOL NAME</section>
      <title>TOOL TITLE</title>
      <text>
         <![CDATA[ 
         <ul>
            <li>FEATURE 1</li>
            <li>FEATURE 2</li>
            <li>FEATURE 3</li>
         </ul>
         ]]>
      </text>
      <links>
         <link>
            <label>TOOL LINK LABEL 1</label>
            <referer>https://mytool1.com/</referer>
         </link>
         <link>
            <label>TOOL LINK LABEL 2</label>
            <referer>https://mytool2.com/</referer>
         </link>
      </links>
   </tool>
   <tool>
      ...
   </tool>
</descriptions>

Simply I cannot get data from settings.xml

-Thanks for help

  • 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-09T22:00:26+00:00Added an answer on June 9, 2026 at 10:00 pm

    in case that I have xml inside portlet then this helped:

     $.ajax({
                type:"GET",
                url: "<%= request.getContextPath()%>/js/settings.xml",
                dataType: "xml",
     ...
    

    settings.xml is in $PORTLET-DIR/docroot/js/

    I the second case when I tried to load xml anywhere from server

    @Override
    public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
        response.setContentType("application/xml;charset=UTF-8");
        response.getPortletOutputStream().write("http://mydomain.com/settings.xml");
    }
    

    I get this eclipse error message

    Multiple markers at this line
        - The method write(int) in the type OutputStream is not applicable for the arguments 
         (String)
        - url cannot be resolved to a variable
    

    I would like to be able to read the xml from the same server as Liferay or, if it is possible, read it from different server

    Thanks

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

Sidebar

Related Questions

I'm developing a liferay portlet. Here is my code in jsp file: <table class=DDGridView>
I'm developing a portlet for Liferay 6.1. At some point I'm evaluating input from
Hi i am developing Liferay faces portlet in Liferay 6.0.6 portal + 6.1 Plugins
There is a guide on the Liferay site Developing a Portlet with Multiple Actions
I'm developing a JSF 2.0 portlet for Liferay 6.0.6 (Plugins SDK 6.1) and I
I am developing a Portlet with Liferay (using liferay-ui in the JSP) and SpringMVC.
I'm considering developing an application as portlets, to be integrated in Liferay portal. Are
While developing an application using gwt in ecliplse crashed. Now the server is running
Developing search utility to search a file entire computer system, works fine on windows
developing an application in Access. The access file will be located on a db

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.