I designed one Signup page by using HTML, CSS, JQuery. My client side validation Done by using JQuery. I need to validate in server side. I need to validate my sign up page in Java as middle tier and backend I m going to use SQL. How I can done validation in java and how can I link my client side code to Java Web Service. Which Web service shall I have to use in java?
please help me anyone!. I m frustrating for more than 2 weeks.
PS: If anyone wants to see my code I m ready to give my code.
What is your java setup? you are using servlet? or managed frameworks like JSF-deriven libs? or?
The work is easy, you should find out what is your target java bean/servlet is located. Then set the correct action for your html form page. Also consider(if you are using servlet) set the correct method, by default it’s GET. Either make sure you are getting data from doGet in your java code, or if you are in JSF, it’s different, client page and form should be prepared by jSF page, not manually.
For the validation, you may use apache common I think comes with some common validation liek email, etc… (but for email please note only trusted way is validating by sending a verification link, becasue
firstname.lastname@example.org is a real email, but not exist)
For SQL part, make sure it’s prepared to avoid SQL_injection, same for some more performance. Also don’t forget to pool your connection if you are using JDBC over any ORM stuff.
Not just these, but you should start and do it step by step. Later consider set token for forms to avoid CSRF, SSL, and more stuffs…
So for now, please tell us what is your setup for server?
Thanks for your kindly reply.
I just uploaded my code in Github Repository. Can you please check it for me and reply it. Please find the below link for my github repository which is I saved my code here. I almost done by using Java code. I want to know I am going in correct way or not.
Web services are more like API, they are used for system-to-system communication, rather than system-to-user or vice versa.
But it’s still possible to use it in your case.
I still don’t know your java setup, such as server you are running your code? your context? it’s spring?(I’m not spring expert)
Do you get any request on server from your client? what about checking logs?
Are you sure the js file(client) sends anything to server? Check if it’s sending to a correct context if any. Form in html has no action(target), plus no method(default is GET), and in your js there is no anything to submit the form.
I’m sorry I cannot help more than this for now, since it looks like spring, and I’m not a fan and expert.
You may need to find a good spring tutorial/reference and follow it. There are some forum about spring out there of course, ask the experts, they would help you out.