java - Spring Rest- result page does not display results instead requested resource is not available -


i don't know if i'm doing correctly i'm using spring , creating rest client-server. index.jsp displays form user enters information dog, , click submit , should go result page should displays result (so they've entered). problem when user fills out form , clicks submit error "requested resource not available". can tell me going wrong, why welcome.jsp page create error?

index.jsp (contains form)

<body>      <form action="welcome.jsp" th:action="@{/dog}" th:object="${dog}" method="post">         <p>id: <input type="text" th:field="*{id}" /></p>         <p>name: <input type="text" th:field="*{name}" /></p>         <p>heartbeat: <input type="text" th:field="*{heartbeat}" /></p>         <p>temperature: <input type="text" th:field="*{temperature}" /></p>         <p>lat: <input type="text" th:field="*{lat}" /></p>         <p>long: <input type="text" th:field="*{lon}" /></p>         <p>weight: <input type="text" th:field="*{weight}" /></p>         <p><input type="submit" value="submit" /> <input type="reset" value="reset" /></p>     </form>  </body> 

welcome.jsp (should display result of user entered)

<body>   <h1>result</h1>     <p th:text="'id: ' + ${dog.id}" />     <p th:text="'content: ' + ${dog.name}" />     <a href="index.jsp">submit message</a> </body> 

dogcontroller-get post request

@restcontroller @requestmapping("/dog") public class dogcontroller {      private static final string template = "hello, %s!";     private final atomiclong counter = new atomiclong();      @requestmapping(value="", method = requestmethod.get)     public createdog greeting() {         return new createdog(counter.incrementandget(),"dog", 40, 25, 120, 71.0486,114.0708);     }      @requestmapping(value="", method = requestmethod.post)     public string createdog(@modelattribute createdog dog, model model) {         model.addattribute(dog);         return "result";     } } 

i'm not sure what's th:action for. seems have 2 actions tag in page, right?

you can try visit url browser directly , see if can result.

you can refer here


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -