I’m using play-1.2.4, but i found the javascript file can’t generate urls with the tag:
@{Users.login()}
Indeed i can use
/Users/login
instead , but it will cause problems when i export to war files and run it in tomcat.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Take a look at the JSAction tag. http://www.playframework.org/documentation/1.2/ajax
The purpose of the jsAction tag is to be able to generate the URLs that you need to call from the routes file. However, these need to be defined inside of your views, as they need to be generated serverside by Play, and not inside a js file.
If you really want to be able to keep most of your code inside of your JS file, then you can generate the method names in your main.html file, and reference from within your javascript file.
example
then you can access this using