加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Scala播放传递变量以查看无法正常工作

发布时间:2020-12-16 18:03:37 所属栏目:安全 来源:网络整理
导读:这段代码工作正常: 在控制器中: Ok(views.html.payment(message,test,x_card_num,x_exp_date,exp_year,exp_month,x_card_code,x_first_name,x_last_name,x_address,x_city,x_state,x_zip,save_account,product_array,x_amount,products_json,auth_net_cust
这段代码工作正常:

在控制器中:

Ok(views.html.payment(message,test,x_card_num,x_exp_date,exp_year,exp_month,x_card_code,x_first_name,x_last_name,x_address,x_city,x_state,x_zip,save_account,product_array,x_amount,products_json,auth_net_customer_profile_id,auth_net_payment_profile_id,customer_id))

在视图中:

@(message: String,test: String,x_card_num: String,x_exp_date: String,exp_year: String,exp_month: String,x_card_code: String,x_first_name: String,x_last_name: String,x_address: String,x_city: String,x_state: String,x_zip: String,save_account: String,product_array: Map[String,Map[String,Any]],x_amount: String,products_json: String,auth_net_customer_profile_id: String,auth_net_payment_profile_id: String,customer_id: String)

但是,当我尝试向控制器添加一个变量并像这样查看时:

Ok(views.html.payment(message,customer_id,saved_payments_xml))


@(message: String,customer_id: String,saved_payments_xml: String)

它给了我这个错误:

missing parameter type

我究竟做错了什么?

解决方法

您可以传递给 template的参数数量有限制.添加其他参数时已超出该参数.

这是一个未记录且相当随意的限制,这是模板生成代码的工作原理.它可以说是一个错误,但不是我要修复的错误,因为没有人需要这么多的参数,并且有这么多使得代码的可读性更低.

这里你最好的解决方案是重构,例如通过创建一些案例类来表示模型中的Card和Address,然后传递它们.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读