Ajax – Get a Business Object list in JSP

I am trying to make a Ajax call from my JSP and generating a ArrayList of a business object in the servlet. Now I don’t know how to iterate the list and populate the BO in JSP.

My code as below:

Servlet code :

        ArrayList<TestBO> ajaxList = new ArrayList<>();
        TestBO bo = new TestBO();

        bo = new TestBO();

        PrintWriter out = response.getWriter();

JSP Code :

     type: 'GET',
     url: '/TestWeb/AjaxServletList',
     success: function(data) {
         var values = [];
         values = data;


Need your help guys

Can someone please tell me how to validate the credentials or write the logics for the following off note in Selenium web driver

How to always load in HTTPS. If requested via unencrypted HTTP, it should redirect to HTTPS.
— input must be able to accommodate names which include apostrophes, dashes, or accented characters
• Email addresses must contain an @ character, and must use a top-level domain of at least two characters.
• Phone numbers are numeric only
• The color of text should always have a contrast of 4.5:1 with its background.
• Cant accept inputs for name, email, or phone number which exceed 255 characters
• Whenever an input fails to validate, there should be a visual indicator of which field failed to validate.

Please help me with this if possible
Thanks for the support

Imbed website without certain scripts

I am trying to embed another website of mine into my main one. I have the knowledge on how to embed a website, but I am trying to embed the website with deleting some scripts from loading. I have thought about just copying the code and pasting it into mine, but we update the website every few hours. So basically, I am trying to embed one of my websites into another without loading certain scripts (such as the header, some images, and some other scripts.

Thanks in advance,

how to fetch password policy data stored in database

i make a project which is about the password policy. but i’m having a problem on how to fetch the data of password policy (minlength, maxlength, character, etc) which is stored in the database and use it at the password textbox. i don’t know how to popup the alert on the password textbox based on the password policy stored in the database. do you get me? i really need help because next week i have a presentation. please help meee. T.T btw im using php.

Adding Paypal button in Play framework Java 2.6

I am trying to implement the button of the payment method Paypal. So I wanted to follow the guide on the website. I am using Java and the Play framework 2.6.

They give the following code on the website to add in your own code:

<!DOCTYPE html>

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://www.paypalobjects.com/api/checkout.js"></script>

<div id="paypal-button"></div>


        env: 'production', // Or 'sandbox',

        commit: true, // Show a 'Pay Now' button

        payment: function() {
            // Set up the payment here

        onAuthorize: function(data, actions) {
            // Execute the payment here

    }, '#paypal-button');

My code is a little bit different Because I have for the head a different file (called main.scala.html). So the main looks like this:

* This template is called from the `index` template. This template
* handles the rendering of the page header and body tags. It takes
* two arguments, a `String` for the title of the page and an `Html`
* object to insert into the body of the page.
@(title: String)(content: Html)

<!DOCTYPE html>
<html lang="en">
        <!-- These are the meta and scripts for paypal-->
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="https://www.paypalobjects.com/api/checkout.js" data-version-4></script>

        @* Here's where we render the page title `String`. *@

            <!-- Loading third party fonts -->
            <link href="@routes.Assets.versioned("fonts/another_font.css")" rel="stylesheet" type="text/css">

        <!-- Loading weather css file -->
        <link rel="stylesheet" href="@routes.Assets.versioned("stylesheets/bootstrap.css")">
        <link rel="stylesheet" href="@routes.Assets.versioned("stylesheets/weather.css")">

        <link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">

        <script src="@routes.Assets.versioned("javascripts/jquery-3.2.1.min.js")" type="text/javascript"></script>
        <script src="@routes.Assets.versioned("javascripts/bootstrap.js")" type="text/javascript"></script>

        @* And here's where we render the `Html` object containing
        * the page content. *@

The Content that gets called in the Main for the body looks like this:

    @main("ReStart") {
            <!-- Payment Methods -->
                        <div class="col-md-9">
                            <h2>payment methodes</h2>
                            <div id="paypal-button"></div>


                                        env: 'production', // Or 'sandbox',

                                        commit: true, // Show a 'Pay Now' button

                                        payment: function() {
                                            // Set up the payment here

                                        onAuthorize: function(data, actions) {
                                            // Execute the payment here

                                    }, '#paypal-button');
        <!-- Required for the banner -->
        <script src="@routes.Assets.versioned("javascripts/jquery-1.11.1.min.js")"></script>

        <script src="@routes.Assets.versioned("javascripts/plugins.js")"></script>
        <script src="@routes.Assets.versioned("javascripts/app.js")"></script>


In the Main file i added the meta and the script links. In the content file there is the call to render the button, but for some reason i just can’t render it.

Things i tried:

  1. Downloaded the checkout.js and used the following script tag

     <script src="@route.Assets.Versioned("javascript/checkout.js")"></script>
  2. I tried the script tags (with link and downloaded js file) in both files. In the Main and in the content file.

It looks so simple but for some reason I can’t figure it out.

Get a result from a react native app integrated into an existing android app

I found a lot of articles speaking about how to integrate react native into existing android apps. But none of them explains how to get a result back from the react native code in order to use it directly in Java android source code.

Explanations : I have a react native app that is doing a specific job and displays the result in a popup window.
I want to integrate this app (doing the necessary modifications) to be able to get this specific result into my android Java source code instead of displaying it into a react native popup.

I searched all the internet but found nothing about this.

Veracode reports XSS issue in XMLHttpResponse Javascript

I have struts 2.x web application. In this application, I am using XMLHttpRequest for refreshing a div with a table. I have a separate JSP page for rendering the HTML table. I get the JSP page response in XMLHttpRequest and update the response to div. Veracode is showing XSS issue on innerHTML line of code. Please suggest me how can I sanitize the HTML content here?

   function ajaxFileUploadRefresh(){
        var xmlhttp;
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        if (xmlhttp.readyState==4 && xmlhttp.status==200){
            document.getElementById("StatusDiv").innerHTML=xmlhttp.responseText; // Refreshing the Div with response. This is where Veracode shows error.
        xmlhttp.open("POST","StrutsAction_methodName",true); // This action will be redirected to jsp
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");


Ramana Reddy

How to convert invalid json which have date parse method from javascript to JSONObject in Android?


In above json "responseTime":Ext.Date.parse("2017-10-20T10:12:02.648","Y-m-dTH:i:s.u") is a Javascript function.

while converting to json, I getting error as

Unterminated object at character 179 of {"@class":"java.util.HashMap","mobile-gen150847698538144":{"@class":"com.yl.commons.service.impl.ServiceResponseWrapper","headers":{},"responseTime":Ext.Date.parse("2017-10-20T10:53:02.761","Y-m-dTH:i:s.u"),"serviceResponseNotice":{"@class":"com.yl.scm.service.srn.GridSrn","result":[],"totalRecords":0},"batch":false},"mobile-gen1508476985354853":{"@class":"com.yl.commons.service.impl.ServiceResponseWrapper","headers":{},"responseTime":Ext.Date.parse("2017-10-20T10:53:02.761","Y-m-dTH:i:s.u"),"serviceResponseNotice":{"@class":"com.yl.scm.service.srn.GridSrn","result":[],"totalRecords":0},"batch":false}}

Can anyone help me to convert it to proper json.

Vaadin google Maps | Hide POIs from the map

Hi i’m using vaadin google maps in my application. i want to remove the points of interests like hotels,bus stations, etc from the map. based on numerous amounts of searches i’ve done i could only find answer for to turn it off using JS but not through vaadin. does anyone have any answer to it?

generate a 12-byte random in Java

I was recently asked to do a task as the following:
“We need to generate a key, which has a 12-byte binary value. The key is created by concatenating little-endian 8-byte random number with 4 bytes of zero-padding.
To construct the actual key, one would need to copy little-endian version of the 8-byte number to a string and append four zero bytes.”

What would be the best way to do so in JAVA or JavaScript ?