JSOUP extract data from <select name=...> - java

here's an html code. I want to print "Color:" and various color options present. And somehow I want it by using "select name=att1" that means by name tag of select.
<div class="box-body">
<div id="attributeInputs" class="attribute-inputs" data-defcolor="Palm">
<div class="row thinpad-top att1row">
<div class="small-24 columns">
<label for="att1_BA0FEDC6-8BF1-11E4-B816-87E377679EE2">Color:</label>
</div>
<div class="small-24 columns">
<select name="att1" id="att1_BA0FEDC6-8BF1-11E4-B816-87E377679EE2">
<option value="">Please Select Color</option>
<option value="Black">Black</option>
<option value="Palm">Palm</option>
</select>
</div>
I've tried so many jsoup tags. But I'm not able to get required output
I want output something like this:
Please Select Color:
Black
Palm
please help

This code will extract the elements inside the select tag and option tag
String html="<div class=\"box-body\">\n" +
"\n" +
" <div id=\"attributeInputs\" class=\"attribute-inputs\" data-defcolor=\"Palm\">\n" +
"\n" +
" <div class=\"row thinpad-top att1row\">\n" +
" <div class=\"small-24 columns\">\n" +
" <label for=\"att1_BA0FEDC6-8BF1-11E4-B816-87E377679EE2\">Color:</label>\n" +
" </div>\n" +
" <div class=\"small-24 columns\">\n" +
" <select name=\"att1\" id=\"att1_BA0FEDC6-8BF1-11E4-B816-87E377679EE2\">\n" +
" <option value=\"\">Please Select Color</option>\n" +
" <option value=\"Black\">Black</option>\n" +
" <option value=\"Palm\">Palm</option>\n" +
" </select>\n" +
" </div>";
Document doc = Jsoup.parse(html);
Elements links = doc.select("select option");
for (Element link : links) {
String linkText = link.text();
System.out.println(linkText);
}

Related

Jsoup to fetch data from html betwwen two <br> tags

I am working on a personal project and wants to parse this html and retrieve information from this.
Basically I want to get all the information that is given inside the 'br' tags ,for this I am using JSOUP in java .
I want to store these value as pairs in a map (key,value).
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style> </style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="">
<div class="WordSection1">
<p class="MsoNormal">
<span style=""></span>
</p>
<p class="MsoNormal">
<span style=""></span>
</p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="MsoNormal">
<a name="_MailOriginal">
<b>
<span style="">From: </span>
</b>
</a>
<span style="">
<span style=""> ABC (membership#abc.org)
<br>
<b>Sent: </b> Tuesday, November 24, 2020 8:13 AM <br>
<b>To: </b> XYZ <XYZ#abc.com>
<br>
<b>Subject: </b> Information Request </span>
</span>
</p>
</div>
</div>
<p class="MsoNormal">
<span style=""></span>
</p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100.0%">
<tbody>
<tr style="">
<td style="background:#910A19; padding:5.25pt 1.5pt 5.25pt 1.5pt">
<span style=""></span>
</td>
<span style=""></span>
<td width="100%">
<div>
<p class="MsoNormal" style="">
<span style="">
<b>
<span style="font-size:12.0pt; font-family:" ` Calibri (Body)`",serif; color:#212121">EXTERNAL EMAIL: Beware of Phishing attacks! </span>
</b>
</span>
</p>
</div>
</td>
<span style=""></span>
</tr>
</tbody>
</table>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%; background:#B2B2B2">
<tbody>
<tr style="">
<td style="padding:25.0pt 25.0pt 25.0pt 25.0pt">
<div align="center">
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" width="600" style="width:6.25in; background:white; border:solid black 1.0pt">
<tbody>
<tr style="">
<td style="border:none; padding:2.0pt 2.0pt 2.0pt 2.0pt">
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="">
<tbody>
<tr style="">
<td style="border:none; border-bottom:solid #CDCDCD 1.0pt; padding:7.5pt 3.75pt 7.5pt 3.75pt">
<p class="MsoNormal">
<span style="">
<span style="border:solid windowtext 1.0pt; padding:0in">
<img width="100" height="100" id="_x0000_i1025" src="cid:~WRD2635.jpg" alt="Image removed by sender.">
</span>
</span>
<span style="">
<span style=""></span>
</span>
</p>
</td>
<span style=""></span>
<td width="100%" style="width:100.0%; border:none; border-bottom:solid #CDCDCD 1.0pt; padding:7.5pt 3.75pt 7.5pt 3.75pt">
<p class="MsoNormal">
<span style="">
<b>
<span style="font-size:18.0pt; font-family:" Arial",sans-serif">AWSCV </span>
</b>
</span>
</p>
</td>
<span style=""></span>
</tr>
</tbody>
</table>
<span style=""></span>
</td>
<span style=""></span>
</tr>
<tr style="">
<td style="border:none; padding:2.0pt 2.0pt 2.0pt 2.0pt">
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="">
<tbody>
<tr style="">
<td style="border:none; border-bottom:solid #CDCDCD 1.0pt; padding:7.5pt 7.5pt 7.5pt 7.5pt">
<p class="MsoNormal">
<span style="">
<span style="font-size:9.0pt; font-family:" Arial",sans-serif">Dear XYZ, <br>
<br>The following Information Request form was submitted by ABC, Company: asd, Email: asd#abc.com on 11/23/2020. <br>
<br>Information: <br>
<br>Legal Business Name <br>Asfdsf <br>
<br>Phone <br>(718) 43543 <br>
<br>Principle Name 1 <br>afdsgsfgsg df <br>
<br>EIN <br>04543 <br>
<br>Bus Street Address <br>fdgfdgfdg <br>
<br>Bus City <br>fgfdvgdsgs <br>
<br>Bus State <br>dsf <br>
<br>Bus Zip Code <br>34543534 <br>
<br>Email Address <br>abc#gamil.com <br>
<br>Secondary Email Address <br>abc#gamil.com <br>
<br>Business Website Address <br>NOEMAIL.COM <br>
<br>DBA info same as Business <br>
<br>DBA information is same as Business. <br>
<br>DBA Name <br>Asfdsf <br>
<br>DBA Street Address <br>sgfdgfdg435435 34 <br>
<br>DBA City <br>ACDCROCK <br>
<br>DBA State <br>AT <br>
<br>DBA Zip Code <br>324324 <br>
<br>DBA Phone <br>(458) 43543543 <br>
<br>DBA Email Address <br>abc#gamil.com <br><br>Secondary DBA Email Address <br>--- No answer --- <br><br>Tertiary DBA Email Address <br>--- No answer --- <br><br>DBA Website Address <br>NOEMAIL.COM <br><br>Secondary DBA Website Address <br>--- No answer --- <br><br>Tertiary DBA Website Address <br>--- No answer --- <br><br>Information Request Text <br>Any information would be helpful <br><br> Description <br>ACCESSORIES <br><br>wegf <br>4545 <br><br>Point of Sale Type <br>dfgfdg/sdgfdsgdsg (Default) <br><br><br><br>Attachments: </span></span>
</p><table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" width="600" style="width:6.25in; background:white; border:outset black 1.0pt"><tbody><tr style=""><td style="padding:2.0pt 2.0pt 2.0pt 2.0pt"><p class="MsoNormal"><span style=""><span style="color:black">Attachments </span></span><span style=""><span style=""></span></span></p></td><span style=""></span><td style="padding:2.0pt 2.0pt 2.0pt 2.0pt"><p class="MsoNormal"><span style=""><span style="color:black"></span></span><span style=""><span style=""></span></span></p></td><span style=""></span></tr></tbody></table><p class="MsoNormal"><span style=""><span style="font-size:9.0pt; font-family:" Arial",sans-serif"><br><br>Your type includes you in the list of members to whom forms of this type are sent. You can opt out of receiving forms of this type via the Forms link on your Profile screen. </span></span></p>
</td><span style=""></span>
</tr>
</tbody>
</table><span style=""></span>
</td><span style=""></span>
</tr><tr style=""><td style="border:none; padding:2.0pt 2.0pt 2.0pt 2.0pt"><div><p class="MsoNormal"><span style=""><i><span style="font-size:7.5pt; color:#666666">This email was sent in response to the use of the platform and website by AWCC. It was generated by: </span></i></span></p><div style="margin-left:11.25pt; margin-top:3.0pt"><p class="MsoNormal"><span style=""><i><span style="font-size:7.5pt; color:#666666">AAXC, LLC <br>43543543 fgfdgfdg <br>AXD, WE 324324 <br>dgfdgfdgfd (457-dsfds) - Outside the US, call +1 45435435435 </span></i></span></p></div></div></td><span style=""></span></tr>
</tbody>
</table>
</div><span style=""></span>
</td><span style=""></span>
</tr>
</tbody>
</table><span style=""></span><p class="MsoNormal"><span style=""></span></p>
</div>
</body>
</html>
I am using this code to fetch but this is giving all values in a paragraph.
Document doc = Jsoup.parse(htmlString);
List<String> valueList = new ArrayList<>();
Elements keyElements = doc.getElementsByTag("td");
for (Element keyElement : keyElements) {
String value = keyElement.text();
// store in value list
}
I also tried
doc.getElementsByTag("br");
but his is giving empty value.
I want to store each the values in a map like this but not able to separate the value from html as this is coming in paragraph or empty.
My Map ..
Key VALUE
Phone (718) 3543
Legal Business Name Asfdsf
DBA City XYXXdsfds
... and so on
Can someone please help me to get this data in a better way?
it must be getElementsByTagName . T.T
You can use this solution:
Document.OutputSettings outputSettings = new Document.OutputSettings();
outputSettings.prettyPrint(false);
doc.outputSettings(outputSettings);
doc.select("br").before("\\n");;
doc.select("p").before("\\n");
String str = doc.html().replaceAll("\\\\n", "\n");
String strWithNewLines = Jsoup.clean(str, "", Safelist.none(), outputSettings);
System.out.println(strWithNewLines);
I suppose you can try this:
If the HTML String was this:
String html = "<html>\n"
+ " </head>\n"
+ "<table class=\"MsoNormalTable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"\">\n"
+ " <tbody>\n"
+ " <tr style=\"\">\n"
+ " <td>\n"
+ " <p class=\"MsoNormal\">\n"
+ " <span style=\"\">\n"
+ " <span style=\"font-size:9.0pt; font-family:\"Arial\",sans-serif\">\n"
+ " <br>\n"
+ " <br>Information: \n"
+ " <br>\n"
+ " <br>Legal Business Name\n"
+ " <br>Asfdsf\n"
+ " <br>\n"
+ " <br>Phone\n"
+ " <br>(718) 43543\n"
+ " <br>\n"
+ " <br>Principle Name 1\n"
+ " <br>afdsgsfgsg df\n"
+ " <br>\n"
+ " <br>Bus Street Address\n"
+ " <br>sdfdsf\n"
+ " <br>\n"
+ " <br>Bus City\n"
+ " <br>sdfdsf\n"
+ " <br>\n"
+ " <br>Bus State\n"
+ " <br>ny\n"
+ " <br>\n"
+ " <br>Bus Zip Code\n"
+ " <br>4324324\n"
+ " <br>\n"
+ " <br>Email Address\n"
+ " <br>dsfdsfds#xyz.com\n"
+ " <br>\n"
+ " <br>Tertiary Email Address\n"
+ " <br>--- No answer ---\n"
+ " <br>\n"
+ " <br>Business Website Address\n"
+ " <br>dsfdsf.com\n"
+ " <br>\n"
+ " <br>DBA info same as Business\n"
+ " <br>\n"
+ " <br>DBA information is same as Business.\n"
+ " <br>\n"
+ " <br>DBA Name\n"
+ " <br>Awqeewd gdfg\n"
+ " <br>\n"
+ " <br>DBA Street Address\n"
+ " <br>dsfdsf 3432 fdgdf\n"
+ " <br>\n"
+ " <br>DBA City\n"
+ " <br>NORTH\n"
+ " <br>\n"
+ " <br>Attachments:\n"
+ " </span>\n"
+ " </span>\n"
+ " </p>\n"
+ " <p class=\"MsoNormal\">\n"
+ " <span style=\"\"> \n"
+ " </span>\n"
+ " </p>\n"
+ " </div>\n"
+ " </body>\n"
+ " </html>";
And you run this string through the following method provided below:
String[] values = getTextAfterHtmlStartEndTags(html, "br");
// Display the discovered values...
for (String str : values) {
System.out.println(str);
}
The console Window will display:
Information:
Legal Business Name
Asfdsf
Phone
(718) 43543
Principle Name 1
afdsgsfgsg df
Bus Street Address
sdfdsf
Bus City
sdfdsf
Bus State
ny
Bus Zip Code
4324324
Email Address
dsfdsfds#xyz.com
Tertiary Email Address
--- No answer ---
Business Website Address
dsfdsf.com
DBA info same as Business
DBA information is same as Business.
DBA Name
Awqeewd gdfg
DBA Street Address
dsfdsf 3432 fdgdf
DBA City
NORTH
Attachments:
The getTextAfterHtmlStartEndTags() method:
/**
*
* To be used with the JSoup API<br><br>
* <b>Example Usage:</b><br><pre>
*
* <b>Required Imports:</b>
*
* import org.jsoup.Jsoup;
* import org.jsoup.nodes.Document;
* import org.jsoup.nodes.Element;
* import org.jsoup.nodes.Node;
* import org.jsoup.select.Elements;
*
* <b>Example Code:</b>
*
* {#code String html = "<td>\n"
* + " <span class=\"detailh2\" style=\"margin:0px\">This month: </span>2 145 \n"
* + " <span class=\"detailh2\">Total: </span> 31 704 \n"
* + " <span class=\"detailh2\">Last: </span> 30.12.2021 \n"
* + "</td>";
*
* String[] values = getTextAfterHtmlStartEndTags(html, "span");
* for (String str : values) {
* System.out.println(str);
* }}</pre><br>
* <p>
* The console window will display:
* <pre>
*
* 2 145
* 31 704
* 30.12.2021</pre><br>
* <p>
* If you want the data from a specific HTML tag element then you can supply
* one or more text elements within those HTML tags in th optional
* 'specificTo' parameter as a string array or as args, for example:
* <pre>
*
* {#code String[] values = getTextAfterHtmlStartEndTags(html, "span", "This month:", "Total:");
* for (String str : values) {
* System.out.println(str);
* }}</pre><br>
* <p>
* The console window will display:
* <pre>
*
* This month: --> 2 145
* Total: --> 31 704</pre>
*
* #param htmlString (String) The HTML string to parse.<br>
*
* #param htmlStartTagString (String) The HTML start tag to get data
* from.<br>
*
* #param specificTo (String - args) The desired data from multiple
* HTML tags of the same type (see the above
* example code).<br>
*
* #return (String[] Array) A single Dimensional String Array containing the
* desired data (if properly parsed and found).
*/
public static String[] getTextAfterHtmlStartEndTags(String htmlString,
String htmlStartTagString, String... specificTo) {
String html = htmlString;
List<String> list = new ArrayList<>();
String value = "N/A";
Document doc = Jsoup.parse(html);
Elements elements = doc.select(htmlStartTagString);
for (Element a : elements) {
if (specificTo.length > 0) {
for (int i = 0; i < specificTo.length; i++) {
if (a.before("</" + htmlStartTagString + ">").text().contains(specificTo[i])) {
Node node = a.nextSibling();
value = specificTo[i] + " --> " + node.toString().trim();
list.add(value);
}
}
}
else {
Node node = a.nextSibling();
value = node.toString().trim();
list.add(value);
}
}
return list.toArray(new String[list.size()]);
}

JSoup: How to remove an element from a Form?

I use jsoup for parsing html page and submit form. I need to remove "Back" button before submit form. I use element.remove() method, but then I see that form.formData() has not changed. Requested element has removed from form.children() but exists in form.elements(). Is this a bug or I use wrong way to remove element from form?
public class JsoupCheck {
public static void main(String[] args) {
String html = "<html><body><form action=\"demo\">"
+ "<input type=\"submit\" name=\"buttonSave\" value=\"Save\">"
+ "<input type=\"submit\" name=\"buttonBack\" value=\"Back\">"
+ "<select name=\"selection\">"
+ " <option value=\"value1\">Value 1</option>"
+ " <option value=\"value2\" selected>Value 2</option>"
+ " <option value=\"value3\">Value 3</option>"
+ "</select>"
+ "</form></body></html>";
Document doc = Jsoup.parse(html);
FormElement form = (FormElement) doc.select("form").first();
Element e = form.select("form").first();
System.out.println("=== Original content of form");
System.out.println(e);
System.out.println("=== Original content of form.formData()");
for (Connection.KeyVal i : form.formData()) {
System.out.println(i.key() + "=" + i.value());
}
System.out.println("form.elements().size() = " + form.elements().size());
System.out.println("form.children().size() = " + form.children().size());
e.select("input[name=buttonBack]").remove();
System.out.println();
System.out.println("=== Content of form after remove buttonBack (result: buttonBack removed)");
System.out.println(e);
System.out.println("=== Content of form.formData() after remove buttonBack (result: buttonBack exist)");
for (Connection.KeyVal i : form.formData()) {
System.out.println(i.key() + "=" + i.value());
}
System.out.println("form.elements().size() = " + form.elements().size());
System.out.println("form.children().size() = " + form.children().size());
}
}
Output is:
=== Original content of form
<form action="demo">
<input type="submit" name="buttonSave" value="Save">
<input type="submit" name="buttonBack" value="Back">
<select name="selection"> <option value="value1">Value 1</option> <option value="value2" selected>Value 2</option> <option value="value3">Value 3</option></select>
</form>
=== Original content of form.formData()
buttonSave=Save
buttonBack=Back
selection=value2
form.elements().size() = 3
form.children().size() = 3
=== Content of form after remove buttonBack (result: buttonBack removed)
<form action="demo">
<input type="submit" name="buttonSave" value="Save">
<select name="selection"> <option value="value1">Value 1</option> <option value="value2" selected>Value 2</option> <option value="value3">Value 3</option></select>
</form>
=== Content of form.formData() after remove buttonBack (result: buttonBack exist)
buttonSave=Save
buttonBack=Back
selection=value2
form.elements().size() = 3
form.children().size() = 2
FormElement is a special kind of node. Besides maintaining a list of all children (inherited from Node), it holds a second internal list of all elements within the form.
public class FormElement extends Element {
private final Elements elements = new Elements();
...
}
When you call Node#remove on a child, it updates the parent's list of children, not the internal list.
Therefore, to really remove an element, you also need to remove it from this internal list:
e.select("input[name=buttonBack]").remove();
form.elements().removeIf(e -> e.attr("name").equals("buttonBack"));

how to retrieve data from strong tags in html file using jsoup?

I have some html data like
<div class="bs-example">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">ABC</h3>
</div>
<div class="panel-body">
<div class="slimScroller" style="height:280px; position: relative;" data-rail-visible="1" data-always-visible="1">
<strong>Name:</strong>
<br />
<strong>ID No:</strong> XXXXX<br />
<strong>Status:</strong> ACTIVE<br />
<strong>Class:</strong> 5<br />
<strong>Category:</strong> A<br />
<strong>Marks:</strong> 500<br />
</div>
</div>
</div>
</div>
I want output as (multiple students data):
Name: ABC
ID No.: XXXXX
Status: Active
Class: 5
Category: A
Marks: 500
How to get this data using jsoup or any other way? Please help.
You can use Element.nextElementSibling() or/and Element.nextSibling() to get the output you need.
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class Exam {
public static void main(String[] args) {
String html = "<div class=\"bs-example\">" +
" <div class=\"panel panel-primary\">" +
" <div class=\"panel-heading\">" +
" <h3 class=\"panel-title\">ABC</h3>" +
" </div>" +
" <div class=\"panel-body\">" +
" <div class=\"slimScroller\" style=\"height:280px; position: relative;\" data-rail-visible=\"1\" data-always-visible=\"1\">" +
" <strong>Name:</strong>" +
" <br />" +
" <strong>ID No:</strong> XXXXX<br />" +
" <strong>Status:</strong> ACTIVE<br />" +
" <strong>Class:</strong> 5<br />" +
" <strong>Category:</strong> A<br />" +
" <strong>Marks:</strong> 500<br />" +
" </div>" +
" </div>" +
" </div>" +
"</div>";
Document doc = Jsoup.parse(html);
Elements eles = doc.select("div.slimScroller strong");
for(Element e :eles)
System.out.println(e.text() +
( e.nextElementSibling().tagName().equals("a")?
e.nextElementSibling().attr("href").replace("https://", ""):
e.nextSibling().toString()));
}
}
The following code should provide the output specified based off your comment describing how your a tags are:
private static void printStudentInfo(Document document){
Elements students = document.select("div.slimScroller strong");
for(Element student : students){
System.out.print(student.text());
System.out.println(student.nextElementSibling().tagName().equals("a") ?
student.nextElementSibling().text() : student.nextSibling().toString());
}
}

Jsoup how to parse text inside span class="hps"

<span id="result_box" class="short_text" lang="es">
<span class="hps">
hello
</span>
<span class="hps">
world
</span>
</span>
I want to get the hello world String using Jsoup but i have no idea how to do this.
Use Jsoup.parse to get the html Document. Select the elements that you want using css selector like: span.hps (http://jsoup.org/apidocs/org/jsoup/select/Selector.html)
Document doc = Jsoup.parse("<span id=\"result_box\" class=\"short_text\" lang=\"es\">\n" +
" <span class=\"hps\">\n" +
" hello\n" +
" </span>\n" +
" <span class=\"hps\">\n" +
" world\n" +
" </span>\n" +
"</span>");
System.out.println(doc.html());
Elements els = doc.select("span.hps");
for(Element e:els){
System.out.print(e.text());
}
In case you don't care about each element value you can replace the for loop:
els.text()

Invoking Java Applet with dynamic parameters

Here's the scenario. The user fill a form with a certain number of parameters in an html page, then I need to invoke my applet with this specific parameters, possibly within the same page. What's the easiest way to perform this pass?
I'm using the runApplet function, but it's not working. No messages in the JS console and in the Java console.
<html>
<head>
<title>Compila i dati</title>
</head>
<body>
<script src=
"http://www.java.com/js/deployJava.js"></script>
<script>
function runApplet(){
var attributes = { id:'anID', code:'Test', width:1, height:1, codebase: '.'} ;
var parameters = {width:'100', height:'100', code:'Test', archive: 'applet.jar, xyz.jar, abc.jar',
posX: document.forms["form1"]["posX"].value , posY: document.forms["form1"]["posY"].value , heightSign: '300' , widthSign: '600' ,
PDFUrl: 'http://anurl' ,
type:'application/x-java-applet' , scriptable:'false' } ;
deployJava.runApplet(attributes, parameters, 1.6);
}
</script>
<form name = "form1" onsubmit="runApplet()">
<div>
<label for="name">Nome:</label>
<input type="text" name="nome" />
</div>
<div>
<label for="mail">Cognome:</label>
<input type="text" name="cognome" />
</div>
<div>
<label for="msg">X:</label>
<input type="text" name="posX" />
</div>
<div>
<label for="msg">Y:</label>
<input type="text" name="posY" />
</div>
<div class="button">
<button type="submit">Invia</button>
</div>
</form>
</body>
I could try to create an dinamic applet contanier via javascript in this way:
$('#idappletv').empty();
$('#idappletv').hide();
var _xmhlcode = " <script> function javafxEmbed() {" +
"dtjava.embed( " +
"{" +
" id: 'myBrApplet'," +
" url : 'pages/applet/myApplet.jnlp'," +
" placeholder : 'javafx-app-placeholder'," +
" width : 890 ," +
" height : 200," +
" jnlp_content : 'bmFtZT0iQXBwbGV0RnhCcm93c2VyIiAvPg0KICA8dXBkYXRlIGNoZWNrPSJhbHdheXMiLz4NCjwvam5scD4NC=='" +
", params: {param1:'" + param1 + "',param2:'" + param2 + "'}" +
"}," +
"{" +
" javafx : '2.2+'" +
"}," +
"{}" +
");" +
"}" +
"dtjava.addOnloadCallback(javafxEmbed); </" + "script> ";
$('#idappletv').append("<div id='javafx-app-placeholder'></div>");
$('#idappletv').append(_xmhlcode);
dtjava.addOnloadCallback(javafxEmbed);
$('#idappletv').show();
Then when the applet starts you can read the parameter using:
#Override
public void start(Stage primaryStage) {
Parameters params = getParameters();
String param1 = params.getNamed().get("param1");
String param2 = params.getNamed().get("param2");
You can read the parameter "param1 and param2" from your html page.
It should be works.
I used JavaFX with java-webstart (http://docs.oracle.com/javafx/2/deployment/deploy_swing_apps.htm).

Categories

Resources