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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:48:57+00:00 2026-06-15T05:48:57+00:00

I’ve a JSP with a drop-down and 2 text fields for user to select

  • 0

I’ve a JSP with a drop-down and 2 text fields for user to select the role and to enter username and password respectively. I need to get the user selected role and the uname and pwd and set it in the bean. Please help me !! am very new to Spring.. tell me from the basic like how I should pass that.

How to get the username password and role values from the JSP and set in the bean using Java spring?

<html>
    <head>
        <script type="text/javascript">
            function enableTextBox() {
                if (document.getElementById("dropdown").value == "Admin") {
                    document.getElementById("uname").disabled = false;
                    document.getElementById("pwd").disabled = false;
                } else {
                    document.getElementById("uname").disabled = true;
                    document.getElementById("pwd").disabled = true;
                }
            }

            function doClear() {
                document.getElementById("uname").value = "";
                document.getElementById("pwd").value = "";
            }
        </script>
    </head>

    <body>
        <table border=0 width=100% height=100%>
            <tr>
                <td valign="middle" align="center">
                    <table border="1" bordercolorlight="#C0C0C0" style="border-collapse: collapse"
                    bordercolor="#C0C0C0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td valign="middle" align="center" style="width: 400px">
                                <table border="0">
                                    <tr>
                                        <td colspan=2>
                                            <p align="center">
                                                <img src="images/logo.jpg" width="144" height="66">
                                        </td>
                                    </tr>
                                    <td align="center" colspan=2>
                                        <FONT COLOR=BLUE SIZE=3>Welcome</FONT>
                                    </td>
                                    <tr>
                                        <td align="center" colspan=2>
                                            <STRONG><font size="4">Auction Site </font> </STRONG><font size="4"><BR>
     </font>
                                        </td>
                                    </tr>
                                    <tr>
                                        <tr align=center>
                                            <td align="right"><b>Select your role:</b>
                                            </td>
                                            <td align="left">
                                                <select name="dropdown" id="dropdown" onchange="enableTextBox();">
                                                    <option value="Admin">Admin</option>
                                                    <option value="csc">CSC Employee</option>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr align=center>
                                            <td align="right"><b>User ID:</b>
                                            </td>
                                            <td align="left">
                                                <input type="text" id="uname" name="uname" value="" size="15" />
                                            </td>
                                        </tr>
                                        <tr align=center>
                                            <td align="right"><b>Password:</b>
                                            </td>
                                            <td align="left">
                                                <input type=password id="pwd" name="pwd" value="" size="15" />
                                            </td>
                                        </tr>
                                        <tr align=center>
                                            <input type="submit" id="sub" name="sub" value="Submit" size="15" />
                                            <td align="left">
                                                <input type="button" id="clr" name="clr" value="Reset" onclick="doClear()"
                                                />
                                            </td>
                                        </tr>
                                </table>
                            </td>
                            </tr>
                    </table>
                </td>
                </tr>
        </table>
    </body>
</html>
  • 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-15T05:48:59+00:00Added an answer on June 15, 2026 at 5:48 am

    You dont mention anything about where the username/role comes from or is stored.
    So I assume you are approaching this in a the wrong for a spring MVC app.
    Perhaps you have come from php or something, where you just put your code in the php file and display the value in html, also in the same file.

    In MVC, there is a completely different way of approaching things.
    First you should consider your model/domain. This would be a User object and a Role object in your case.
    Then you would build controllers to manage these objects. Then you would look at views (jsp) to present these objects to the end user. So in your case, jsp is the last thing to consider.

    I recommend using spring ROO to build your simple app. It will generate/scaffold a spring MVC app based on your model/domain classes. It also uses all the spring best practices, so is a good way to learn how it all works.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I need to clean up various Word 'smart' characters in user input, including but
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I've tracked down a weird MySQL problem to the two different ways I was

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.