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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:09:23+00:00 2026-06-05T16:09:23+00:00

I trying to populate the dropdown list when page was loaded.But it is not

  • 0

I trying to populate the dropdown list when page was loaded.But it is not loaded in UserPage.jsp from Controller.on submit method and also wrote referencedata method.

Controller:-

public ModelAndView onSubmit(HttpServletRequest request,
            HttpServletResponse response, Object command, BindException errors)
            throws Exception {

        log.info("onSubmit handleRequest method"
                + request.getParameter("username"));
        System.out.println("onSubmit handleRequest method"
                + request.getParameter("username"));
        String username = "", password = "";
        username = request.getParameter("username");
        password = request.getParameter("password");

        UserBean ubean = null;

        System.out.println("After shownform method called");
        HttpSession session = request.getSession(true);
        try {
            ubean = userservice.chkUsername(username, password);
            System.out.println("Information" + ubean.getUsername());
        } catch (DataException ex) {
            ex.printStackTrace();

            // throw ex;
        }
        session.setAttribute("User", ubean);
        EmpPersonalBean personalBean = new EmpPersonalBean();
        return new ModelAndView("jsp/UserPage", "EmpPersonalBean", personalBean);
    }
                 protected Map referenceData(HttpServletRequest request) throws Exception {
        log.info("UserDBBoardController======================referenceData");
        Map referenceData = new HashMap();
        List deparementList = new ArrayList();
        deparementList = userservice.getDeparmentList();
        referenceData.put("deparmentList", deparementList);
        return referenceData;

    }

UserPage.jsp

<%@ page language="java" import="com.aims.bean.*,java.util.HashMap" contentType="text/html;charset=utf-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<html>
<head>
<title>AAI</title>
</head>
<body>
<form:form method="post" modelAttribute="EmpPersonalBean" action="userpage.htm">
<table>
<tr>
    <td>Welcome <%=((UserBean)session.getAttribute("User")).getUsername()%></td>
</tr>
        <tr>

        <td>Department</td>
        <td><form:select path="deparment">
                      <form:option value="NONE" label="--- Select ---" />
                      <form:options items="${deparmentList}" />
                       </form:select>
        </td>
    </tr>
</tr>
</table>
</form:form>
</body>
</html>


public class DepartmentBean {
private String deptcode,deptname;

public String getDeptcode() {
    return deptcode;
}

public void setDeptcode(String deptcode) {
    this.deptcode = deptcode;
}

public String getDeptname() {
    return deptname;
}

public void setDeptname(String deptname) {
    this.deptname = deptname;
}

}

And also attached displaying dropdown list in the userpage.sjpenter image description here

Please help me.How to resolve the issue.

  • 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-05T16:09:26+00:00Added an answer on June 5, 2026 at 4:09 pm

    You also need to specify itemLabel and itemValue attributes in <form:options/> tag.

    UPDATE

    Replace this line in your jsp page. I think it should resolve your problem.

    <form:options items="${deparmentList}" itemLabel="deptname" itemValue="deptcode" />
    

    Hope this helps you. Cheers.

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

Sidebar

Related Questions

I'm trying to populate a dropdown list inside a repeater, but I'm not being
I'm trying to populate a dropdown list in my web page from a mysql
I am just trying to populate a html.dropdown list using mvc2 in VS2008. But
I am trying to populate a dropdown list from database. In my view file
I am trying to populate a dropdown list when some other drop down gets
I am trying to populate the second dropdown from my choice in the second,
I am trying to get the selected option from a dropdown and populate another
I am trying to populate a dropdown menu on an events page with a
Background - I'm trying to populate a drop down list with state information from
I am trying to dynamically populate a dropdown list based on the information in

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.