How to enable jsp pages using spring form tag?

I use Spring because I have user.jsp

user.jsp has three separate branches: 1. Personal, 2. Educational, 3. Awards. Each section has different .jsp forms that I created.

Now I am going to include these three forms in user.jsp and display the model using one controller.

Here is my controller class code:

 @Controller @RequestMapping(value="profile") public class UserProfileController { @RequestMapping(value="user", method=RequestMethod.GET) public String user(Model model) throws Exception { model.addAttribute("profile", new PersonalForm()); return "profile/user"; } 

And this is my Personal.jsp file (all other files are the same, but the names are different)

So how to include these three jsp in user.jsp ? I'm actually trying, but Eclipse shows an error. The following is the error code in user.jsp :

The fragment "profile / professional.jsp" was not found on the expected path / EClass / WebContent / WEB -INF / pages / profile / profile / professional.jsp

So please help me how to enable and how to work with one controller?

+4
source share
1 answer

In your User.jsp write the following code ...

  <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <fieldset id="profile_proffiesional"> <form:form action="profile/user" modelAttribute="profile"> <jsp:include page="personal.jsp"></jsp:include> <jsp:include page="educational.jsp"></jsp:include> <jsp:include page="awards.jsp"></jsp:include> </form:form> </fieldset> 
+7
source

All Articles