Reputation: 1463
I am studying Java EE (using Intellij with a WildFly server) and encountered the next problem:
I am working in MVC and the teacher gave us a MVC-template to use. The template itself works just fine but if I include a new JSP page, it won't show up in the browser. The browser will only show the path like this:
The default 'hello world' is working however (but isn't using a path for a specific reason?:
This has made me thinking if this has to do with the MVC-spring approach to programming? But why isn't student.jsp showing? I tried to make a href in the default welcome page for redirecting to it for testing but it still gives me the same 'error'.
What am I doing wrong here? I feel kind of embarrassing asking this since it looks like a very simple problem and specially since I haven't found any related threads about it.
The student.jsp page itself is correct to my knowing:
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
<title>Spring MVC Form Handling</title>
</head>
<body>
<h2>Student Information</h2>
<form:form method="POST" action="addStudent">
<table>
<tr>
<td><form:label path="name">Name</form:label></td>
<td><form:input path="name" /></td>
</tr>
<tr>
<td><form:label path="age">Age</form:label></td>
<td><form:input path="age" /></td>
</tr>
<tr>
<td><form:label path="id">id</form:label></td>
<td><form:input path="id" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit"/>
</td>
</tr>
</table>
</form:form>
</body>
</html>
Upvotes: 0
Views: 318
Reputation: 1458
You can not run a single .jsp file in any spring project. You can only run projects in the spring framework. So when you include a new JSP page, it won't show up in the browser.
If you want to run your .jsp file then 1) You must run your SpringMVCTemplate project rather than just a file, and 2) The included .jsp file must be in use of the SpringMVCTemplate, not just a simple "hello world" file.
Hope it helps :)
Upvotes: 1