2017-10-24 16 views
1

私はこれを私のスカラ・プレイ・ビューに表示したいと思います。スカラPlayフレームワークのURLが正しく動作していない

<iframe src="http://localhost:9020/index.html#/group/sectiona/sectionb">Loading...</iframe> 

このURLをハードコードすると動作します。しかし、私はそれが動的であることを望みます。私は試した;

  1. <iframe src="http://localhost:9020/index.html#/group/{{ 'http:\//localhost:9020\/#\/group\/' + myclass.section + '\/' + myclassb.section }}/testtopic">Loading...</iframe>
  2. <iframe src="http://localhost:9020/index.html#/group/{{myclass.section}}/sectionb">Loading...</iframe>
  3. <iframe class="graphiframe" src="{{ 'http:\//hello' + myclass.section + 'world'}}" frameborder="0" style="overflow:hidden" height="100%" width="100%">Loading...</iframe>
  4. <iframe class="graphiframe" src="{{ 'http://hello' + myclass.section + 'world'}}" frameborder="0" style="overflow:hidden" height="100%" width="100%">Loading...</iframe>

など。この

なしに動作しません。 4と5で要素を調べるとsrc全体がiframeからなくなり、エラーメッセージAction not found. For request 'GET /%7B%7B%20'http:///hello'%20+%20myclass.section%20+%20'world'%7D%7D'Action not found. For request 'GET /%7B%7B%20'http://hello'%20+%20myclass.section%20+%20'world'%7D%7D'のiframeが表示されます。私はplay.filters.headers.frameOptions = nullのようにapplication.confを変更しました。それは、プレイ2.4.0を使用しています。

どうすればこの問題を解決できますか?あなたは "魔法の『@』文字" 必要

答えて

0

https://www.playframework.com/documentation/2.6.x/ScalaTemplates

ので

<iframe src="http://localhost:9020/index.html#/group/{{myclass.section}}/sectionb">Loading...</iframe> 

<iframe src="http://localhost:9020/index.html#/group/@myclass.section/sectionb">Loading...</iframe> 

または

<iframe src="http://localhost:9020/index.html#/group/@{myclass.section}/sectionb">Loading...</iframe> 
+0

でなければなりませんが、両方試してみました。これは 'localahost:9020 /#/ group/@ {@ myclass.section}'と、最初は 'localahost:9020 /#/ group/@@ myclass.section'です。 '{} 'の代わりに' {{}}'を使うと何も動かない。 –

関連する問題