I'm a newbie and trying to make JSP project, I'm stuck at making Controller.java This is the code that I already have:
package com.assignment;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HomeContronller {
@RequestMapping("/order")
public ModelAndView message(@RequestParam("name") String name,
@RequestParam("email") String email,
@RequestParam("pnumber") String pnumber,
@RequestParam("address") String address,
@RequestParam("pizztype") String pizzatype,
@RequestParam("pizzasize") String pizzasize,
@RequestParam("numpizza") String numpizza
)
{
ModelAndView m = new ModelAndView("page1");
m.addObject("name", name);
m.addObject("email", email);
m.addObject("pnumber", pnumber);
m.addObject("adress", address);
m.addObject("pizzatype", pizzatype);
m.addObject("pizzasize", pizzasize);
return m;
}
}
I need help to create a discount code that when type 1111 will give 10 % discount and 2222 will give 30% discount