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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:17:04+00:00 2026-06-09T13:17:04+00:00

I am using struts2 framework for my application. I am also using jquery validation

  • 0

I am using struts2 framework for my application.
I am also using jquery validation for validating form input at client side.
however they both don’t go with one another quite well.

I have the UserBean Class which I want it to be there.

I m using the following jquery & struts form.. which does not validate the form

    <script type="text/javascript">
        $(document).ready(function(){
            var validator = $("#myform").validate({
                rules: {
                    username: "required",
                    password: "required"
                },
                messages: {
                    username: "Please enter your username",
                    password: "Please enter your password"
                }
            });
        });
    </script>

 <s:form method="POST" action="doLogin" name="myform" id="myform" cssClass="form" theme="simple">
            <s:fielderror theme="simple" >

                    <label class="control-label" for="username">User Name </label>

                        <s:textfield name="userBean.userName" label="USER NAME"/>
                        <s:param>userBean.userName</s:param>



                    <label class="control-label" for="username">Password  </label>


                        <s:password name="userBean.password" label="PASSWORD" />
                        <s:param>userBean.password</s:param>

                <s:submit name="Submit" value="Submit"/>
            </s:fielderror>
        </s:form>
  • 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-09T13:17:05+00:00Added an answer on June 9, 2026 at 1:17 pm

    You input names are userBean.userName and userBean.password so your script declaration must match those names in order to work:

    <script type="text/javascript">
        $(document).ready(function(){
            var validator = $("#myform").validate({
                rules: {
                    "userBean.userName": "required",
                    "userBean.password": "required"
                },
                messages: {
                    "userBean.userName": "Please enter your username",
                    "userBean.password": "Please enter your password"
                }
            });
        });
    </script>
    

    And as per jQuery Validation on field(s) with a prefix in the name property, you need to put the name in quotes because it contains a . in the name.

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

Sidebar

Related Questions

i am validating user input in my application using Struts2 build in validation framework
I am using the struts2 validation framework to validate the data from in client.
I am creating a web application on tomcat in framework struts2. I am using
I'm currently developing a web application using Struts2 framework. This application requires to dynamically
What is more secure and advantageous client side validation using javascript or server side
I'm using Java+struts2+JSP as the web application framework. I have to pass some huge
I am trying to create a new application using Struts2 framework on Tomcat 7.
Ours is a java web application on struts2 framework. Currently for contact us form
I am using hibernate, spring, struts framework for my application. In my application, each
I am using struts2 to build a web application and I use struts2 tags

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.