I have a Login form that call a controler.
<form action="@{Application.callWS()}" method="post">
...
</form>
public static void callWS(){
//some logic
if(true){
renderTemplate("FOLDER1/FOLDER2/MY_View.html"); //call other page
}
else{
renderTemplate("Application/index.html", error); // back to prev page with error variable
}
}
If true I want call other page. But when I do renderTemplate() the url in my page still de same. “http://localhost:9000/application/callws”
I have a controler in controllers/FOLDER1/FOLDER2/My_controller.java.
If true I want call index() from that controller and by doing that change the url to something related with that page.
in routes I have:
GET /My_Page FOLDER1/FOLDER2.My_controller.index
The question is: How can I call other page from first controller and change url to that page.
I am not using framework correctly?
Try using
(not FOLDER/FOLDER2) as FOLDERs are mapped to java packages, which are separated by a dot (package1.subpackage.Class). Make sure your Controller has a package definition as its first statement:
This works to get your controller compiling:
as well as in your route file: