I would like to add some data such as merchant name into database.I wanted it to be retrieved from a dropdownlist or combo box.For example,i added 7-eleven as merchant name into database,from another html page,a user can see "7 eleven" as an option to be selected in a dropdownlist.I don't use any jsp ,just HTML.Now what is successful is that I am able to add a merchant into database,but i don't really know how to pass the merchant name into dropdownlist.Any help would be appreciated!
This is my controller to add merchant
@RequestMapping(value = "/create", method = RequestMethod.POST)
public Object signUp(@ModelAttribute EmployeeSignUp employeeSignUp, HttpSession session, RedirectAttributes redirectAttributes) {
try {
employeeSignUp.setLoginId(employeeSignUp.getEmail());
EmployeeDetail employee = employeeService.signUp(employeeSignUp);
session.setAttribute("loginId", employeeSignUp.getLoginId());
session.setAttribute("employeeId", employee.getId());
return "redirect:/employeeSignin";
} catch (Exception e) {
return new ModelAndView("employee/create")
.addObject("signUp", employeeSignUp)
.addObject("error", e.getMessage());
}
}
This is another controller that i wish to retrieve merchant name:
@RequestMapping(value = "/product", method = RequestMethod.GET)
public Object uploadProducts(@ModelAttribute UploadCreate uploadCreate,HttpSession session,RedirectAttributes redirectAttributes) {
// redirectAttributes.addFlashAttribute("list",employeeDetail.getName());
// redirectAttributes.addFlashAttribute("name",employeeDetail.getName());;
return "product/upload";
}
This is the HTML page that I want merchant name to be retrieve from dropdownlist
<form method="post" role="form" enctype="multipart/form-data">
Merchant:
<SELECT NAME="list" style=width:50%;" ID="list">
<OPTION>Select a merchant</OPTION>
{{#list}}
<option>{{name}}</option>
{{/list}}
</SELECT>