I have a table and fragment on on childFragment.html
<div th:fragment="firstTable">
<table border="2">
<tbody>
<tr th:each="rt : ${fragment}">
<td th:text="${rt.id}"></td>
<td th:text="${rt.number}"></td>
<td th:text="${rt.number2}"></td>
</tr>
</tbody>
</table>
</div>
How can I insert it in the another html page?
Related
This is my controller class read data method. I cant read spring data from requesting. when I do it from postman it works fine but cant read using html page.
#RequestMapping("/index")
public String ItemList(Model model) {
model.addAttribute("itemList", repository.findAll());
return "index";
}
Like this I try to read data using my index.html page
<h2>Medicine List</h2>
<form action="/index" method="POST">
<table>
<thead>
<tr>
<th>ID</th>
<th>MedicineName</th>
<th>Description</th>
<th>Quantity</th>
<th>Price</th>
<th>ExDate</th>
</tr>
</thead>
<tbody>
<tr th:each="item:${itemList}">
<td th:text="${item.id}"></td>
<td th:text="${item.MedicineName}"></td>
<td th:text="${item.Description}"></td>
<td th:text="${item.Quantity}"></td>
<td th:text="${item.Price}"></td>
<td th:text="${item.ExDate}"></td>
<td><form action="/delete/item:${itemList}" method="Delete"><input type="submit" value="Delete" /></form></td>
</tr>
</tbody>
</table>
</form>
I have a table of reviews
<table class="table">
<tbody>
<tr th:each="review : ${reviewsForMovie}">
<td th:utext="${review.text}"></td>
</tr>
</tbody>
</table>
But I dont want to show review if review.isApproved == false
How do i do that?
<table class="table">
<tbody>
<tr th:each="review : ${reviewsForMovie}">
<td th:hidden="${!review.isApproved}" th:utext="${review.text}"></td>
</tr>
</tbody>
</table>
Using java.net.URLConnection to fetch data from html is not fetching the actual data but only the html code.
Since the html is generating data dynamically the core html code doesn't have the data that is being displayed on the html.
Is there any other means of fetching the data being displayed on the html page?
My code goes like this:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class Example {
public static void main(String[] args) throws IOException {
System.setProperty("java.net.useSystemProxies", "true");
// Make a URL to the web page
URL url = new URL("https://rci-dtengine.rnd.ki.sw.ericsson.se/root//proj/cpptemp/jcat-cpp/DI/megatron/DT/INT_PA284/20170331_152720/20170331_152723/index.html");
// Get the input stream through URL Connection
URLConnection con = url.openConnection();
InputStream is =con.getInputStream();
// Once you have the Input Stream, it's just plain old Java IO stuff.
// For this case, since you are interested in getting plain-text web page
// I'll use a reader and output the text content to System.out.
// For binary content, it's better to directly read the bytes from stream and write
// to the target file.
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
// read each line and write to System.out
while ((line = br.readLine()) != null) {
System.out.println(line);
}
}
}
Output:
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="img/jcat_m3.png"/>
<title>JCAT Test Report</title>
<link rel="stylesheet" type="text/css" href="css/jquery.fancybox.css" />
<link rel="stylesheet" type="text/css" href="css/top.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="css/testsuite.css" />
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/jquery.fancybox.pack.js"></script>
<script src="js/jquery.storage.js"></script>
<script src="js/stupidtable.min.js"></script>
<script src="js/common.js"></script>
<script src="js/top.js"></script>
<script src="js/testsuite.js"></script>
<script>
window.onerror = function () {
alert("Failed to load data files as the format is corrupt!");
};
function receiveMessage(event) {
if (event.data !== "reload from settings") {
return;
}
window.location.reload();
}
window.addEventListener("message", receiveMessage, false);
</script>
<script src="json/suite.data.js"></script>
<script src="json/top.data.js"></script>
<script src="json/bulletin.message.data.js"></script>
</head>
<body>
<div class='top'></div>
<div id="bulletin">
<div id="bulletinBar">
<img id="bulletinSwitch"></img>
<span id="bulletinHint" style="display:none">hide bulletin</span>
</div>
<div id="bulletinFrame" class="ui-widget-content">
<div id="bulletinContent"></div>
</div>
</div>
<div id="autoRefresh">
<span id="refreshCountDown" style="display:none"></span>
<input id='autoRefreshBtn' type='button' value='enable auto refresh'></input>
</div>
<div id="content">
<div id="sumBlock">
<h3>Report Summary</h3>
<table id="suiteInfo" summary="Suite summary information">
<tbody>
<tr>
<td width="130px">Suite name:</td>
<td id="suiteName"></td>
</tr>
<tr>
<td>Run by:</td>
<td id="runBy"></td>
</tr>
<tr>
<td>Time started:</td>
<td id="startTime" class="timestamp"></td>
</tr>
<tr>
<td>Time finished:</td>
<td id="endTime" class="timestamp"></td>
</tr>
<tr>
<td>Duration:</td>
<td id="duration"></td>
</tr>
</tbody>
</table>
</div>
<div id="staBlock">
<h3>Statistics</h3>
<table id="statistics" summary="Suite statistic">
<tbody>
<tr>
<td width="100px">Passed TCs:</td>
<td id="tcPassed" width="50px"></td>
<td width="120px">Passed configs:</td>
<td id="configTcPassed" width="50px"></td>
</tr>
<tr>
<td>Failed TCs:</td>
<td id="tcFailed"></td>
<td >Failed configs:</td>
<td id="configTcFailed"></td>
</tr>
<tr>
<td>Error TCs:</td>
<td id="tcError"></td>
<td>Error configs:</td>
<td id="configTcError"></td>
</tr>
<tr>
<td>Skipped TCs:</td>
<td id="tcSkipped"></td>
<td>Skipped configs:</td>
<td id="configTcSkipped"></td>
</tr>
<tr>
<td>Excluded TCs:</td>
<td id="tcExcluded"></td>
<td>Executed configs:</td>
<td id="configTcRun"></td>
</tr>
<tr>
<td>Inconclusive TCs:</td>
<td id="tcInconclusive"></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Executed TCs:</td>
<td id="tcRun"></td>
<td></td>
<td></td>
</tr>
<tr>
<td>UnExecuted TCs:</td>
<td id="tcNotRun"></td>
<td>TCs & configs:</td>
<td id="tcTotalRun"></td>
</tr>
</tbody>
</table>
</div>
<div id="testCases">
<input placeholder="Search..." type="text" id="filterText" maxlength="200" style="margin-left:5px;"/>
<div id='viewSwitch' style='display:none'>
| <span id="nestedFunc" style='display:none'> Show Nested Suites<input id='nestedSwitch' onchange="switchSuiteTable(this)" type="checkbox" value="Nested"></span>
<span id="groupedFunc" style='display:none'> Show Grouped Suite<input id='groupedSwitch' onchange="switchSuiteTable(this)" type="checkbox" value="Grouped"></span>
Auto-unfold Errors<input id='autoUnfold' onchange="setAutoUnfold()" type="checkbox" value="autoUnfold" checked="checked">
<input id="unfoldFunc" type="button" value="Unfold" onclick="$('tr.folded').click()">
<input id="foldFunc" type="button" value="Fold" onclick="$('tr.unfolded').click()">
</div>
| <span id="filter_icondown" style="color: #99cc00">►</span> <span id="filter_iconright" style="color: #99cc00; display: none">▼</span>
<a id="filterHide" href="javascript:hideUnhideTable('filter')">Filters</a>
<div id="jcat_label">
| <span id="label_text">Labels:</span>
<select id="label_select">
</select>
</div>
<table id="filter" style="display: none;">
<tr>
<td width="120px">Passed TCs/configs:</td>
<td width="50px"><a id="label_passed" href="javascript:hideUnhideRows('passed')">Hide</a></td>
<td width="160px">Skipped TCs/configs:</td>
<td width="50px"><a id="label_skipped" href="javascript:hideUnhideRows('skipped')">Hide</a></td>
<td width="160px">All testcases:</td>
<td width="50px"><a id="label_testcases" href="javascript:hideUnhideRows('testcases')">Hide</a></td>
</tr>
<tr>
<td>Failed TCs/configs:</td>
<td><a id="label_failed" href="javascript:hideUnhideRows('failed')">Hide</a></td>
<td>Excluded TCs/configs:</td>
<td><a id="label_excluded" href="javascript:hideUnhideRows('excluded')">Hide</a></td>
<td>All configuration methods:</td>
<td><a id="label_cfgs" href="javascript:hideUnhideRows('cfgs')">Hide</a></td>
</tr>
<tr>
<td>Error TCs/configs:</td>
<td><a id="label_error" href="javascript:hideUnhideRows('error')">Hide</a></td>
<td>Inconclusive TCs/configs:</td>
<td><a id="label_inconc" href="javascript:hideUnhideRows('inconc')">Hide</a></td>
<td>All reruned testcases:</td>
<td><a id="label_rerun" href="javascript:hideUnhideRows('rerun')">Show</a></td>
</tr>
</table>
<table id="suiteTable" class='suite'>
<thead>
<tr>
<th data-sort="int" id="tcIndex" style="display:none">Index</th>
<th data-sort="string">ID</th>
<th data-sort="string">Name</th>
<th data-sort="string">Type</th>
<th data-sort="string">Heading</th>
<th data-sort="int">State</th>
<th data-sort="string">Additional Result Info</th>
<th data-sort="string" style="display:none;">Start Time</th>
<th data-sort="string" style="display:none;">End Time</th>
<th data-sort="string">Duration</th>
<th data-sort="string">Fetched Logs</th>
<th data-sort="string">Labels</th>
</tr>
</thead>
<tbody></tbody>
</table>
<table id="nestedTable" class='suite Nested' style="display:none">
<thead>
<tr>
<th id="tcIndex" style="display:none">Index</th>
<th>ID</th>
<th>Name</th>
<th>Type</th>
<th>Heading</th>
<th>State</th>
<th>Additional Result Info</th>
<th style="display:none;">Start Time</th>
<th style="display:none;">End Time</th>
<th>Duration</th>
<th>Fetched Logs</th>
<th>Labels</th>
</tr>
</thead>
<tbody></tbody>
</table>
<table id="groupedTable" class='suite Grouped' style="display:none">
<thead>
<tr>
<th id="tcIndex" style="display:none">Index</th>
<th>ID</th>
<th>Name</th>
<th>Type</th>
<th>Heading</th>
<th>State</th>
<th>Additional Result Info</th>
<th style="display:none;">Start Time</th>
<th style="display:none;">End Time</th>
<th>Duration</th>
<th>Fetched Logs</th>
<th>Labels</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</body>
</html>
The only way to know the underlying API is if the site itself makes that information public.
As for loading the page, you’ll need a container capable of loading the page and executing its JavaScript; the WebView class of JavaFX is one such container. Every WebView has an associated WebEngine which provides the loaded page as an XML Document (even if the original content was not XHTML); you can use XPath on that Document to extract the text of the relevant <td> elements.
Hi I am making an app in which I am sending an email to a specific address
This email is a html email with table and images and all...
Is I have tried to add Html.fromhtml() but it keeps saying type mismatch
needed string found spanned....
If you need any of my code please comment
Please suggest any tutorial if you have in mind
EDIT
I forgot to mention I am sending mail using javax.maillibrary I am not using Intents
I tried to use Html.tohtml(Spanned text) its giving the message of type mismatch cant convert String to spannedtext
I have no idea whats happening
I am receiving the html data in my mail if i just go with it
UPDATE
I am fetching the content from a string resource
and this is what I am getting as result
$message = ' For Support enquiry#makeintern.comContact Form Enquiry !
Name: :'.$name.'Email: :'.$email.'Contact: :'.$mobile.'Message:
:'.$message.'Date-Time: :'.$current_date.'
Thanks and Regards MakeIntern Team Account Manager - MakeIntern Cell
www.makeintern.com enquiry#makeintern.com
If any query Please call us on : 011-45544188  www.makeintern.com |
enquiry#makeintern.com 
from---
<string name="email">$message = \'<center>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" bgcolor="#FFFFFF">
<table width="620px" cellpadding="0" cellspacing="0">
<tr>
<td width="400px" bgcolor="#000000" style="color:#FFFFFF; text-
decoration:none; float:left;font-size:10px;margin: -18px 3px -1px 11px; font-weight:bold; padding:2px; text-decoration:none; padding-left:0px;">For Support <span style="text-decoration:none; color:#FFFFFF;">enquiry#makeintern.com</span></td>
<td width="220px" bgcolor="#000000"></td>
</tr>
<tr style="background-color:#737373;">
<td width="290" align="left" valign="middle"><a href="http://makeintern.com" target="_blank"><img src="http://www.makeintern.com/images/makeintern.jpg" width="136" border="0" alt="MakeIntern" style="display:block; padding-left:0px;"></a></td>
<td width="290" align="right" style="text-align:right; font-family:Arial, Segoe UI,Helvetica Neue, Helvetica, sans-serif; font-size:18px; line-height:18px; color:#FFFFFF; font-weight:normal; padding-right:10px;">Contact Form Enquiry !<br>
</td>
</tr>
<tr>
<td height="12px" colspan="2"></td>
</tr>
<tr>
<td colspan="2" align="center" style="line-height:16px; font-family:arial; font-size:12px; color:#888888; text-align:left;">
<table cellspacing="0" cellpadding="0">
<tr>
<td width="200px" style="font-weight:bold;">Name: </td>
<td width="100px">:</td>
<td>\'.$name.\'</td>
</tr>
<tr>
<td width="200px" style="font-weight:bold;">Email: </td>
<td width="100px">:</td>
<td>\'.$email.\'</td>
</tr>
<tr>
<td width="200px" style="font-weight:bold;">Contact: </td>
<td width="100px">:</td>
<td>\'.$mobile.\'</td>
</tr>
<tr>
<td width="200px" style="font-weight:bold;">Message: </td>
<td width="100px">:</td>
<td>\'.$message.\'</td>
</tr>
<tr>
<td width="200px" style="font-weight:bold;">Date-Time: </td>
<td width="100px">:</td>
<td>\'.$current_date.\'</td>
</tr>
</table>
<br/><br/>
Thanks and Regards <br/>
MakeIntern Team <br/>
Account Manager - MakeIntern Cell <br/>
www.makeintern.com<br/>
enquiry#makeintern.com<br/><br/>
<b>If any query Please call us on : 011-45544188</b><br/>
</td>
</tr>
<tr>
<td height="12px"></td>
</tr>
<tr>
<td colspan="2"><img src="http://www.myhotbooking.com/images/email-template/bar.png"></td>
</tr>
<tr>
<td colspan="2" bgcolor="#737373" height="90px">
<table cellpadding="0" cellspacing="0" width="620px">
<tr>
<td height="10px"></td>
</tr>
<tr>
<td align="center" style="color:#FFFFFF;" height="20px"><a href="http://www.makeintern.com/">www.makeintern.com </a>| <span style="color:#FFFFFF; text-decoration:none;">enquiry#makeintern.com</span></td>
</tr>
<tr>
<td align="center" valign="middle">
<a href="https://www.facebook.com/makeinterns" target="_blank"><img src="http://www.myhotbooking.com/images/email-template/icon-facebook.png" width="26" height="26" border="0" alt="Facebook"></a><a href="https://twitter.com/makeintern" target="_blank"><img src="http://www.myhotbooking.com/images/email-template/icon-twitter.png" width="26" height="26" border="0" alt="Twitter"></a><a href="https://www.linkedin.com/company/makeintern" target="_blank"><img src="http://www.myhotbooking.com/images/email-template/icon-linkedin.png" width="26" height="26" border="0" alt="Linkedin"></a><a href="https://plus.google.com/+makeintern" target="_blank"><img src="http://www.myhotbooking.com/images/email-template/icon-google-plus.png" width="26" height="26" border="0" alt="Google+"></a></td>
</tr>
<tr>
<td align="center" style="color:#FFFFFF;"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>\'</string>
Thankyou in advance
Try Below Code :
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT,getResources().getString(R.string.email_subject));
sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(getResources().getString(R.string.email_text)));
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, ""));
string.xml
<resources>
<string name="email_subject">Download App for your smartphone.</string>
<string name="email_text"><![CDATA[Hey,<br/>I just downloaded App on my Android.<br/>It is a smartphone Manager.This app even lets me book parties,search restaurants.<br/>App is available for Android.<br/>
Get it now from http://www.exampleapp.com/download]]></string>
</resources>
I want to click a text related input with preceding-sibling node my HTML is the following:
<FORM id="formid" onsubmit="" method=post name="formid" action=>
<TABLE width="100%">
<TR class=foo-even>
<TD rowSpan=3><INPUT onclick="" value=1 type=radio name="formid">upbutton1</TD>
<TD>Pearl</TD>
<TD rowSpan=3></TD>
</TR>
<TR class=foo-even>
<TD>ravenclawn</TD>
</TR>
<TR class=foo-even>
<TD>ravenclawn</TD>
</TR>
</TBODY>
</TABLE>
</TD></TR>
<TR>
<TD> </TD>
</TR>
</TBODY></TABLE>
<TABLE width="100%" >
<TBODY>
<TR>
<TD class="someclass"></TD>
</TR>
<TR>
<TD>
<TABLE class=foo width="100%" border="1px">
<TBODY>
<TR class=foo-header>
<TD></TD>
<TD><BR></TD>
<TD colSpan=3></TD>
<TD></TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=0 type=radio name="formid.samename">buttonclick1</TD>
<TD>1234</TD>
<TD>blue </TD>
<TD colSpan=2>apple2</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"></TD>
</TR>
<TR class=foo-even>
<TD><INPUT value=1 type=radio name="formid.samename">buttonclick2</TD>
<TD>1235 </TD>
<TD>blue </TD>
<TD colSpan=2>apple3</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=2 type=radio name="formid.samename">buttonclick3</TD>
<TD>1235</TD>
<TD>sometext </TD>
<TD>Pearl</TD>
<TD></TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-even>
<TD><INPUT value=3 type=radio name="formid.samename">buttonclick4</TD>
<TD>1236 </TD>
<TD>blue </TD>
<TD colSpan=2>apple4</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=4 type=radio name="formid.samename">buttonclick5</TD>
<TD>1236 </TD>
<TD>sometext </TD>
<TD>ravenclawn</TD>
<TD></TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-even>
<TD><INPUT value=5 type=radio name="formid.samename">buttonclick6</TD>
<TD>1237 </TD>
<TD>blue </TD>
<TD colSpan=2>apple6</TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"> </TD>
</TR>
<TR class=foo-odd>
<TD><INPUT value=6 type=radio name="formid.samename">buttonclick7</TD>
<TD>1237 </TD>
<TD>sometext </TD>
<TD>ravenclawn</TD>
<TD></TD>
<TD> <INPUT value=0 type=hidden name="samenameagain"></tD>
</DIV>
My target is to click on second Pearl text related input field
Selenium code is the following:
driver.findElement(By.xpath(".//td[contains(text(),'Pearl')][1]/preceding-sibling::td")).click();
Problem:
Above code always working with first table that contains Pearl text
Observations:
That case when im modify first Pearl text to something else the code working fine
That case when im working with another text ect:"ravenclawn" its working fine without any modifications
Thanks for any advice
You just include index for table also.
For 1st table
By.xpath("//table[1]//td[contains(text(),'Pearl')]/preceding-sibling::td")
For 2nd table
By.xpath("//table[2]//td[contains(text(),'Pearl')]/preceding-sibling::td")