P
P
parkito2016-08-24 17:29:23
JavaScript
parkito, 2016-08-24 17:29:23

How to connect javascript with JPA?

Hello. Help, please, deal with the problem.
I am writing a web application. Described database entities and operations on them using JPA.
I am writing a frontend. Tell me how to connect a javascript script that reads information

<div id="main">
    <aside class="leftAside">
        <h2>For registration on this site</h2>
        <p>You should fill all fields bellow
    </aside>
    <section>
        <article>
            <h1>Registration</h1>
            <div class="text-article">
                <form method="POST" action="registration">
                    <p>
                        <label for="login">Login </label>
                        <input type="text" name="login" id="login"/>
                    </p>
                        <p>
                            <label for="email">E-Mail</label>
                            <input type="email" name="email" id="email"/>
                        </p>
                        <p>
                            <label for="password">Password</label>
                            <input type="password" name="password" id="password"/>

                            <label for="password2">Repeat password</label>
                            <input type="password" name="password2" id="password2"/>
                        </p>
                        <p>
                            <label for="name">Name</label>
                            <input type="text" name="name" id="name"/>
                        </p>
                        <p>
                            <label for="secondName">Second name</label>
                            <input type="text" name="login" id="secondName"/>
                        </p>
                        <p>
                            <label for="birthdayDate">Birthday date</label>
                            <input type="text" name="name" id="birthdayDate"/>
                        </p>
                        <p>
                            <label for="adress">Adress</label>
                            <input type="text" name="login" id="adress"/>
                        </p>
                        <p>
                            <button type="submit">SignUp</button>
                        </p>
                </form>
            </div>
        </article>
    </section>
</div>

with code that adds an object to the database.
public void addClient(String name, String secondName,
                          String birthdayData, String passport,
                          String adress, String eMail,
                          String password) {
        Client client = new Client(name, secondName, birthdayData,
                passport, adress, eMail, password);
        if (!isUserExist(eMail))
            MainDAO.addEntetyToBase(client);
        else System.out.println("User " + eMail + " already exists");
    }

What is the name of such a connection (to me for Google).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2016-08-24
@parkito

And you don't need javascript at all, if that. When you click on the button, you will receive the data entered in the form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question