The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

noisebreath (3) [Avatar] Offline
#1
Hello

i do not understand why it forwards to the function goToTutorFormula()
but not to saveCategory() . I use the RequestMapping as illustrated in
Spring in Action third edition book chapter 7.3.1.

my jsp:

<body>
       <p>
               <a /tutor/formular.html"/>">Register a tutor</a>
       </p>
       <form method="post" action="/tutor/save.html">
               <input type="text" name="title"> <br>
               <input type="text" name="firstName" ><br>
               <input type="text" name="lastName" ><br>
               <input type="text" name="email" ><br>
               <input type="text" name="phone" ><br>
               <input type="text" name="profession" ><br>
               <input type="submit" name="submit" value="do it"><br>
       </form>
</body>


My Controller:


import org.hibernate.Session;
import org.hibernate.Transaction;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/tutor")
public class TutorController {

       @RequestMapping(value="/formular")
       public String goToTutorFormula() {
               return "tutor";
       }

       @RequestMapping(value="/save")
       public String saveCategory() {
               return "showTutorData";
       }
}


The Errormessage :

message /tutor/save.html


description The requested resource (/tutor/save.html) is not available.


i dont get it. Can you tell me what i am doing wrong?


And also he does not accept it when i want to add the method type like

@RequestMapping(value="/...", method=GET)


noise

Message was edited by:
noisebreath
noisebreath (3) [Avatar] Offline
#2
Re: Problem with RequestMapping
ive solved the problem with a little bit of luck.
<form method="post" action="./tutor/save.html">

is the solution... u need to put a dot at the beginning of the action.
Can anyone explain y?

Message was edited by:
noisebreath
noisebreath (3) [Avatar] Offline
#3
Re: Problem with RequestMapping
oki seems that i always have to stay relative to the current domain of the uri