Selected value for JSP drop down using JSTL

In HTML, the selected option is represented by the presence of the selected attribute on the <option> element like so: <option … selected>…</option> Or if you’re HTML/XHTML strict: <option … selected=”selected”>…</option> Thus, you just have to let JSP/EL print it conditionally. Provided that you’ve prepared the selected department as follows: request.setAttribute(“selectedDept”, selectedDept); then this should … Read more

IntelliJ and JSP/JSTL cannot resolve taglib for JSTL in tomcat7 [duplicate]

First add this to the top of your .jsp file: <%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c” %> It will still give syntax error but you can fix that by adding javax.servlet:jstl:1.2 as a module dependency. To do that, follow these steps: Click your project name and press F4 to bring up the module settings dialog. Then go … Read more

List as form backing object using Spring 3 MVC, correct syntax?

Maybe this answersyour question: CONTROLLER : @Controller(“https://stackoverflow.com/”) public class FooController{ //returns the ModelAttribute fooListWrapper with the view fooForm @RequestMapping(value = “/FOO”, method = RequestMethod.GET) public String getFooForm(Model model) { FooListWrapper fooListWrapper = new FooListWrapper(); fooListWrapper.add(new Foo()); fooListWrapper.add(new Foo()); //add as many FOO you need model.addAttribute(“fooListWrapper”, fooListWrapper); return “fooForm”; } @RequestMapping(value = “/FOO”, method = RequestMethod.POST) … Read more