2017-12-28 64 views
0

.jsp를 호출하는 다음과 같이 나는 .html 파일이 있습니다웹 시작 자바 FX 응용 프로그램에 매개 변수를 전달하는 방법을

<html> 

    <head> 
    </head> 
    <body> 


<FORM method="post" ACTION="http://localhost/science_city_video_1/Science_City_2.jsp" name="search_push"> 
      <input type="hidden" name="video" value="Science_City_Video_1"> 

<input type="hidden" name="video_description" value="This is the First Video of Science City Cross Roads"> 

        <A href="javascript:document.search_push.submit()" class="style18" > 
        This is our First Video of Science City Cross Roads 

        </A> 

     </form> 


    </body> 
</html> 

JSP 파일은 다음과 인 웹 시작 자바 FX 응용 프로그램을 시작합니다 클릭 할 때 :

이제 두 가지가 일어나고

<html><head> 


<script> 


    function launchApp() { 
     dtjava.launch(
      { url: 'Science_City.jnlp' 
       params: { 
          video: "<%=request.getParameter("video")%>", 
          video_description: "<%=request.getParameter("video_description")%>" 
       } 
      }, 
      { javafx : '2.2+' }, 
      {} 
     ); 
     return false; 
    } 
</script> 

<a href="Science_City.jnlp" onclick="launchApp(); return false;"> 
    Launch me! 
</a> 

<body> 



    </body></html> 
: 웹 스타트가 표시되지 않는 HTML 파일에서 얻은 매개 변수를 시작하고 난 자바 FX 애플리케이션에서 null 값을 얻을

1).

2) jnlp 파일에서 매개 변수 값을 하드 코딩하려고했지만 Javafx Application에서 getParameters(). getNamed(); 다음과 같이

은 .jnlp 파일은 다음과 같습니다

<?xml version="1.0" encoding="UTF-8"?> 
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" codebase="http://localhost/science_city_video_1/" href="Science_City.jnlp"> 
    <information> 
    <title>Science City Video</title> 
    <vendor>Jahnvi Consultants</vendor> 
    <description>null</description> 
    <offline-allowed/> 
    </information> 




    <resources> 
     <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/> 
    <jar href="Science_City.jar" download="eager" /> 
    </resources> 



<application-desc name="Sample app" 
     mainClass="java_video_in_browser.VideoPlayer"> 
    <!-- parameter with name 'simpleParam' and fixed string value--> 
    <param name="video" value="Science_City_1"/> 
    <!-- parameter with name 'complexParam' with value generated 
     at build time --> 

</application-desc> 


<!-- 
<param name="video" value="Science_City_1"/> 
<param name="video_description" value="Robert"/> 






<jfx:javafx-desc width="800" height="600" main-class="java_video_in_browser.VideoPlayer" name="VideoPlayer" /> 
    --> 


</jnlp> 
+0

.jsp 파일은 oracle 웹 사이트의 javafx 튜토리얼에서 가져온 것입니다. .jnlp 파일은 javafx를 브라우저에 임베드 할 때 javafx 응용 프로그램을 기반으로 웹 응용 프로그램 매개 변수를 성공적으로 전달한 것입니다. – Mike

+0

아직 누군가 내 질문에 답변하기를 기다리고 있습니다. – Mike

답변

0

이 내 질문에 대한 부분적인 대답이다. .jnlp 파일이 다음과 같이 편집 된 경우 :

<?xml version="1.0" encoding="UTF-8"?> 
    <jnlp spec="1.0" xmlns:jfx="http://javafx.com" codebase="http://localhost/science_city_video_1/" href="Science_City.jnlp"> 
     <information> 
     <title>Science City Video</title> 
     <vendor>Jahnvi Consultants</vendor> 
     <description>null</description> 
     <offline-allowed/> 
     </information> 




     <resources> 
      <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/> 
     <jar href="Science_City.jar" download="eager" /> 
     </resources> 

    <jfx:javafx-desc width="800" height="600" main-class="java_video_in_browser.VideoPlayer" name="VideoPlayer" > 



    <fx:param name="video" value="Science_City_1"/> 
     </jfx:javafx-desc> 

    </jnlp> 


This works if above changes are made in .jnlp file. The parameter value can be accessed from javafx application. I used following tag: <jfx:javafx-desc to make it work. Also still the passing of parameters from jsp to javafx application via .jnlp does not work.