我正在尝试使用 play 2 自定义模块“securesocial”提出的视图
我已经做的是:
1/ 在“controllers/SecuresViewsPlugin.scala”下创建一个实现 TemplatesPlugin 的新插件名称 SecureViewsPlugin
package controllers
import play.api.mvc.{RequestHeader, Request}
import play.api.templates.Html
import securesocial.controllers.Registration.RegistrationInfo
import securesocial.controllers.TemplatesPlugin
import securesocial.core.{SecuredRequest, SocialUser}
import play.api.data.Form
import securesocial.core.SecureSocial._
import securesocial.controllers.PasswordChange.ChangeInfo
class SecureViewsPlugin(application: App) extends TemplatesPlugin {
override def getLoginPage[A](implicit request: Request[A], form: Form[(String, String)],
msg: Option[String] = None): Html =
{
views.html.secure.login(form, msg)
}
override def getSignUpPage[A](implicit request: Request[A], form: Form[RegistrationInfo], token: String): Html = {
views.html.secure.Registration.signUp(form, token)
}
(..)
2/ 我更新了文件 play.plugins :
1500:com.typesafe.plugin.CommonsMailerPlugin
9996:securesocial.core.providers.utils.DefaultPasswordValidator
9997:controllers.SecureViewsPlugin
3/ 我在“views/secure”文件夹中复制了一个不同的视图
/Views
/secure
/inputFieldConstructor.scala.html
/login.scala.html
/(...)
这是我总是得到的错误的开始
not found: type RequestHeader
In app/views/secure/login.scala.html at line 0.
->@(loginForm: Form[(String,String)], errorMsg: Option[String] = None)(implicit request: RequestHeader)
[error] /Users/clementaubert/Desktop/demo/target/scala-2.9.1/src_managed/main/views/html/secure/login.template.scala:24: not found: type RequestHeader
[error] object login extends BaseScalaTemplate[play.api.templates.Html,Format[play.api.templates.Html]](play.api.templates.HtmlFormat) with play.api.templates.Template3[Form[scala.Tuple2[String, String]],Option[String],RequestHeader,play.api.templates.Html] {
[error] ^
[error] /Users/clementaubert/Desktop/demo/target/scala-2.9.1/src_managed/main/views/html/secure/login.template.scala:27: not found: type RequestHeader
[error] def apply/*1.2*/(loginForm: Form[(String,String)], errorMsg: Option[String] = None)(implicit request: RequestHeader):play.api.templates.Html = {
[error] ^
[error] /Users/clementaubert/Desktop/demo/app/controllers/SecureViewsPlugin.scala:18: type mismatch;
[error] found : play.api.data.Form[(String, String)]
[error] required: play.data.Form[(java.lang.String, java.lang.String)]
[error] views.html.secure.login(form, msg)
[error]
login.scala.html
我试图删除“(隐式请求:RequestHeader)”,但后来我收到了这个错误
type mismatch; found : play.api.data.Form[(String, String)] required: play.data.Form[(java.lang.String, java.lang.String)]
我猜我的做法不对。
我不知道为什么我会收到这些错误