我是scala play框架的新手,我在play 2.3.9中使用了这个JavascriptRoute.scala文件进行AJAX调用,它运行正常。
package controllers
import play.api.Routes
import play.api.mvc.Action
import play.api.mvc.Controller
import play.api.mvc.EssentialAction
import play.core.Router.JavascriptReverseRoute
import play.core.Router._
import routes.javascript.Application.index
import routes.javascript.Organizations.ajaxCallOrgStatus
//import routes.javascript.Users.ajaxCallForDomain
import routes.javascript.Users.domainMap
object JavascriptRoute extends Controller {
/* Application related JavascriptReverse Route will goes here */
val appRoutes: List[JavascriptReverseRoute] = List(index,ajaxCallOrgStatus,domainMap)
/* All JavascriptReverse Route will combine here */
val javascriptRouters = appRoutes
/**
* This is used to generate JavascriptReverseRoute for all provided actions
*
* @return
*/
def javascriptRoutes: EssentialAction = Action { implicit request =>
import routes.javascript._
Ok(Routes.javascriptRouter("jsRoutes")(javascriptRouters: _*)).as("text/javascript")
}
}
当我迁移到2.4框架时,它会显示以下错误
[错误] D:\ my-app \ app \ controllers \ JavascriptRoute.scala:7:value JavascriptReverseRoute不是对象play.core.Router的成员 [error] import play.core.Router.JavascriptReverseRoute [错误] ^ [错误] D:\ my-app \ app \ controllers \ JavascriptRoute.scala:17:找不到:输入JavascriptReverseRoute [error] val appRoutes:List [JavascriptReverseRoute] = List(index,ajaxCallOrgStatus,domainMap)
我已经尝试修复了play 2.4.x的import语句,但是我找不到这个导入的替代方法play.core.Router.JavascriptReverseRoute。
答案 0 :(得分:1)
已移至$ cat test.sh
#!/bin/sh
VAR=foo
if [ $VAR == bar ]; then
echo 'bar!'
fi
: