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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:29:22+00:00 2026-05-27T11:29:22+00:00

I am entering values(URLs) in the text box and when I click the next

  • 0

I am entering values(URLs) in the text box and when I click the next button, validation runs whether the entered url values are valid or not.

if the urls are not valid then i display the error as below

if(valid == false){
this.errors.reject("Incorrect URL is entered for  "+countries.get(countryCode)+" - please ensure to use a correct URL for More Games.")
return [];
                }

Once the error is shown, its clearing the entered values and need to enter the values again. How can I restrict clearing the values(i think the page is getting loaded again) or to restrict the page to load again.

here is the command –

class DeliveryMoreGamesURLCommand implements Command {
    private static final LOG = LogFactory.getLog(DeliveryController.class)

    def wrapperService = ApplicationHolder.application.getMainContext().getBean("wrapperService");
    def customerService = ApplicationHolder.application.getMainContext().getBean("customerService");
    def countryService = ApplicationHolder.application.getMainContext().getBean("countryService");
    def helperService = ApplicationHolder.application.getMainContext().getBean("helperService");
    def ascService = ApplicationHolder.application.getMainContext().getBean("ascService");

    Hashtable<String, String> countries;

    public LinkedHashMap<String, Object> preProcess(sessionObject, params, request) {
        Delivery delivery = (Delivery) sessionObject;

        def customer = Customer.get(delivery.customerId);
        def contentProvider = ContentProvider.get(delivery.contentProviderId);
        def deployment = Deployment.get(delivery.deploymentId);
        def operatingSystem = OperatingSystem.get(delivery.operatingSystemId);

        countries = wrapperService.getCountries(deployment, operatingSystem);
        def sortedCountries = countries.sort { a, b -> a.value <=> b.value };

        def urls =  ascService.getMoreGamesUrlsPerTemplates(deployment, operatingSystem);

        def moreGamesUrls = new Hashtable<String,String>();
        countries.each { country ->
            String countryCode = countryService.getTwoLetterCountryAbbreviation(country.key);
            String url = customerService.getMoreGamesUrl(customer, contentProvider, countryCode);
            if ("".equals(url)) {
                url = urls.get(country.key);
                if (url == null) {
                    url = "";
                }
            }
            moreGamesUrls.put(country.key, url); // We need to use the existing country code if the channels are deployed with three letter country codes
        }

        return [command: this, countries: sortedCountries, moreGamesUrls: moreGamesUrls]
    }

    public LinkedHashMap<String, Object> postProcess(sessionObject, params, request) {
        Delivery delivery = (Delivery) sessionObject;

        def urls = params.gamesUrls;
        LOG.debug("urls from gsp :"+urls)
        try{
        urls.eachWithIndex { u, i ->
            String countryCode = u.key;
            String url = urls["${u.key}"]
            if(url != ""){
            Boolean valid = helperService.isURLValid(url)
                if(valid == false){
                   this.errors.reject("Incorrect URL is entered for "+countries.get(countryCode)+" - please ensure to use a correct URL for More Games.")
                   return [];
                }
            }
        }
        }catch (Exception ex) {
                    logger.warn("Incorrect URL is entered", ex)
                    return [];
        }

        def moreGamesUrls = new Hashtable<String, String>();
        urls.eachWithIndex { u, i ->
            String countryCode = u.key;
            String url = urls["${u.key}"]
            moreGamesUrls.put(countryCode, url);
        }

        delivery.countries = countries;
        delivery.moreGamesUrls = moreGamesUrls;
        LOG.debug("moreGamesUrls after edit=${delivery.moreGamesUrls}");

        return null;
    }
}

from the command preprocess the data will be rendered and after clicking the next button, the postprocess will be invoked and the validation for the url…

  • 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-05-27T11:29:23+00:00Added an answer on May 27, 2026 at 11:29 am

    Resolved this issue by implementing moreGamesUrls as a global variable(which stored the values even after the error is thrown)

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

Sidebar

Related Questions

If am entering some values in text box it should be simultaneously displayed in
I have a text box for entering hex values for specifying color. I have
How can I restrict users from entering special characters in the text box. I
How to store the values which are entered in different text fields to the
Text boxes are appearing below the header but on entering values nothing is happening.
I have some client-side validation against a text box, which only allows numbers up
Making a drop down list for my JSP and the values I'm entering won't
I'm entering data in a datagridview. Say I've entered 678.56 in a cell. Now
How to disable a button after entering a particular letter in a textfield?
I want to use Ckeditor for Entering text and I want to save that

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.