So basically I have this html and what I want is the text under the tag that has the name:, for example I want this cb6a296b-c7ba-4228-b9f2-d6e39947814e, I've tried using soup but for some reason I always obtain a full html instead of the tags themselves. Is there any way of getting this name cb6a296b-c7ba-4228-b9f2-d6e39947814e?
html:
<td>
<div>
<h3>Id:</h3>
<table style="border: none">
<tbody>
<tr>
<td style="border: none"><b>id:</b></td>
<td style="border: none"><span style="margin-left: 15px">testuuid1</span></td>
</tr>
<tr>
<td style="border: none"><b>idtype:</b></td>
<td style="border: none"><span style="margin-left: 15px">uuid</span></td>
</tr>
<tr>
<td style="border: none"><b>territory:</b></td>
<td style="border: none"><span style="margin-left: 15px">GB</span></td>
</tr>
<tr>
<td style="border: none"><b>type:</b></td>
<td style="border: none"><span style="margin-left: 15px">cover</span></td>
</tr>
<tr>
<td style="border: none"><b>version:</b></td>
<td style="border: none"><span style="margin-left: 15px">aa3601f8-219a-43e6-be36-0aa49d2f0943</span></td>
</tr>
</tbody>
</table>
</div>
<div>
<h3>File:</h3>
<table style="border: none">
<tbody>
<tr>
<td style="border: none"><b>extension:</b></td>
<td style="border: none"><span style="margin-left: 15px">jpg</span></td>
</tr>
<tr>
<td style="border: none"><b>md5Checksum:</b></td>
<td style="border: none"><span style="margin-left: 15px">f5e1725f067a697805f4af28bef55720</span></td>
</tr>
<tr>
<td style="border: none"><b>mimeType:</b></td>
<td style="border: none"><span style="margin-left: 15px">image/jpeg</span></td>
</tr>
<tr>
<td style="border: none"><b>name:</b></td>
<td style="border: none"><span style="margin-left: 15px">cb6a296b-c7ba-4228-b9f2-d6e39947814e</span></td>
</tr>
<tr>
<td style="border: none"><b>path:</b></td>
<td style="border: none"><span style="margin-left: 15px"></span></td>
</tr>
</tbody>
</table>
</div>
<div>
<h3>FileInfo:</h3>
<table style="border: none">
<tbody>
<tr>
<td style="border: none"><b>created:</b></td>
<td style="border: none"><span style="margin-left: 15px">2022-08-09T17:05:12Z</span></td>
</tr>
<tr>
<td style="border: none"><b>createdBy:</b></td>
<td style="border: none"><span style="margin-left: 15px">admin</span></td>
</tr>
<tr>
<td style="border: none"><b>expires:</b></td>
<td style="border: none"><span style="margin-left: 15px">2032-06-26T23:30:00Z</span></td>
</tr>
<tr>
<td style="border: none"><b>updated:</b></td>
<td style="border: none"><span style="margin-left: 15px">2022-08-09T17:05:14Z</span></td>
</tr>
<tr>
<td style="border: none"><b>updatedBy:</b></td>
<td style="border: none"><span style="margin-left: 15px">admin</span></td>
</tr>
</tbody>
</table>
</div></td>
Program:
val document: Document = Jsoup.parse(requestBody[0])
val element = document.select("td:contains(name:)").get(0)
You can just give your <span> element an id:
...
<tr>
<td style="border: none"><b>name:</b></td>
<td style="border: none"><span id="file-name" style="margin-left: 15px">cb6a296b-c7ba-4228-b9f2-d6e39947814e</span></td>
</tr>
...
And then you can easily access the value of the field in javascript:
<script>
let fileName = document.getElementById('file-name').innerHTML
...
</script>
I am trying to retrieve the search results from YouTube suggestions using Selenium webdriver (Java) but i am getting the following error. Please help.
Error:
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"class name","selector":"gssb_e"}
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.3', java.version: '1.7.0_55'
Driver info: driver.version: unknown
Code
package test3;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class YoutubeSuggest {
public static void main(String[] args) {
// The Firefox driver supports javascript
WebDriver driver = new FirefoxDriver();
// Go to the youtube home page
driver.get("http://www.youtube.com/");
// Enter the query string "Ozzy "
WebElement query = driver.findElement(By.name("search_query"));
query.sendKeys("Ozzy ");
// Sleep until the div we want is visible or 10 seconds is over
long end = System.currentTimeMillis() + 10000;
while (System.currentTimeMillis() < end) {
WebElement resultsDiv = driver.findElement(By.className("gssb_e"));
// If results have been returned, the results are displayed in a drop down.
if (resultsDiv.isDisplayed()) {
break;
}
}
// And now list the suggestions
List<WebElement> allSuggestions = driver.findElements(By.xpath("//td[#class='gsq_a']"));
for (WebElement suggestion : allSuggestions) {
System.out.println(suggestion.getText());
}
//driver.quit();
}
}
HTML generated by youtube suggestions:
<table dir="ltr" class="gstl_50 gssb_c"
style="width: 585px; top: 39px; position: fixed; text-align: left; left: 230px; display: none;"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="gssb_f"></td>
<td style="width: 100%;" class="gssb_e"><table class="gssb_m"
style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne crazy train</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne no more tears</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne mama i'm coming home</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne paranoid</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne justin bieber</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne mr crowley</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne bark at the moon</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne interview</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr class="">
<td style="text-align: left;" dir="ltr" class="gssb_a gsfs"><div
class="gsq_a">
<table style="width: 100%;" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 100%;"><span>ozzy<b>
osbourne dreamer</b></span></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
Try with below logic to get the youtube search results after loading URL .
driver.findElement(By.name("search_query")).sendKeys("Selenium WebDriver"+Keys.ENTER);
List<WebElement> search_result=driver.findElements(By.cssSelector("#results ol#search-results>li h3>a"));
for(WebElement each_result:search_result) {
System.out.println(each_result.getAttribute("title"));
}
it seems that since the time of writing the tutorial google has changed the element class names. The changes below worked for me.
WebElement resultsDiv = driver.findElement(By.className("sbsb_a"));
List allSuggestions = driver.findElements(By.xpath("//li[#class='sbsb_c gsfs']"));
I want to upload details of a hoarding in mysql database with an image using .jsp and servlet but when i call my servlet it gives a blank page..
My .jsp
<form action="HoardingProfile" method="post" enctype="multipart/form-data">
<table style="height: 100%; width:100%;">
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Location</h3>
</td>
<td style="width: 50%;">
<input type="text" class="tx bk" name="txtLocation"
placeholder="Location" required="yes">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Size</h3>
</td>
<td class="padd10" style="width: 50%;">
<input class="tx bk" type="text" name="txtSize" placeholder="Size"
required="yes">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Owner Name</h3>
</td>
<td style="width: 50%;">
<input type="text" class="tx bk" placeholder="Owner Name"
required="yes" name="txtName">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Contact No.</h3>
</td>
<td style="width: 50%;">
<input type="text" class="tx bk" placeholder="Number"
required="yes" name="txtNumber">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Address</h3>
</td>
<td style="width: 50%;">
<textarea class="tx bk2" placeholder="Address" required="yes"
name="txtAddress"></textarea>
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 15%;">
<td class="tdleft" style="width: 50%;">
<h3>Picture</h3>
</td>
<td style="width: 50%;">
<input type="file" name="file" id="file">
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 50%;">
<h3>Google map</h3>
</td>
<td style="width: 50%;">
<textarea class="tx bk2" placeholder="Google Map iframe"
name="txtMap"></textarea>
</td>
</tr>
<tr style="height: 02%">
<td>
</td>
</tr>
<tr style="height: 10%;">
<td class="tdleft" style="width: 80%;">
<input class="btn" type="submit" name="Add" value="Save"
</td>
<td style="width: 20%;">
<input class="btn" type="reset" value="Reset"
</td>
</tr>
</table>
</form>
and my servlet
PrintWriter out = response.getWriter();
try {
// Apache Commons-Fileupload library classes
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload sfu = new ServletFileUpload(factory);
if (! ServletFileUpload.isMultipartContent(request)) {
System.out.println("Sorry. No file uploaded");
return;
}
// parse request
List<FileItem> items = sfu.parseRequest(request);
out.print(items);
FileItem txtLocation = (FileItem) items.get(0);
String location = txtLocation.getString();
out.println(location);
FileItem txtSize = (FileItem) items.get(1);
String size = txtSize.getString();
out.println(size);
FileItem txtName = (FileItem) items.get(2);
String name = txtName.getString();
out.println(name);
FileItem txtNumber = (FileItem) items.get(3);
String number = txtNumber.getString();
out.println(number);
FileItem txtAddress = (FileItem) items.get(4);
String address = txtAddress.getString();
out.println(address);
// get uploaded file
FileItem file = (FileItem) items.get(5);
// Connect to Oracle
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/opm?zeroDateTimeBehavior=convertToNull","root","");
con.setAutoCommit(false);
PreparedStatement ps = con.prepareStatement("insert into hprofile(location,size,owner,address,phone,deleted,img) values(?,?,?,?,?,?,?)");
ps.setString(1, location);
ps.setString(2, size);
ps.setString(3, name);
ps.setString(4, number);
ps.setString(5, address);
// size must be converted to int otherwise it results in error
ps.setBinaryStream(6, file.getInputStream(), (int) file.getSize());
ps.executeUpdate();
con.commit();
con.close();
out.println("Proto Added Successfully. <p> <a href='listphotos'>List Photos </a>");
}
catch(Exception ex) {
out.println( "Error --> " + ex.getMessage());
}
finally {
out.close();
}
I found out that I made some mistakes while linking the libraries...
I want to print resultset value retrive from SQL JSTL tags.but it gave error
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 219 in the jsp file: /testVoucher.jsp
The method println(boolean) in the type PrintStream is not applicable for the arguments (void)
216:
217:
218: <%
219: System.out.println(
220: %>
221:
222: <%
An error occurred at line: 220 in the jsp file: /testVoucher.jsp
Syntax error, insert ")" to complete Expression
217:
218: <%
219: System.out.println(
220: %>
221:
222: <%
223: );
An error occurred at line: 223 in the jsp file: /testVoucher.jsp
Syntax error on token ")", delete this token
220: %>
221:
222: <%
223: );
224: %>
225:
226:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
The Main part of code is as follows
<sql:preparedStatement id="pst" conn="conn">
<sql:query>
SELECT A.BANK_NAME,B.SCHEME_NAME SCHEME_DESC,
TO_CHAR(SUM(B.GROSS),'99,99,99,99,990.00') GROSS,
round(SUM(B.TDS),0) TDS,
TO_CHAR(SUM(B.ADVANCE),'99,99,99,99,990.00') ADVANCE,
TO_CHAR(SUM(B.PARTIAL),'99,99,99,99,990.00') PARTIAL,
TO_CHAR(SUM(B.NET),'99,99,99,99,990.00') NET
FROM VW_VOUCHER_ALLOCATION_DETAIL B, VW_SCHEME_ACCOUNT A
WHERE B.VOUCHER_NO='<%=voucher%>'
AND B.ID = A.EXPENSE_SCH_CODE
AND (B.GROSS>0 OR B.ADVANCE>0 OR B.PARTIAL>0)
GROUP BY A.BANK_NAME,B.SCHEME_NAME
ORDER BY A.BANK_NAME, B.SCHEME_NAME
</sql:query>
<sql:resultSet id="rs">
<tr style="height:20px">
<td CLASS="BORDER_"><b><sql:getColumn colName="BANK_NAME"/></b></td>
<td CLASS="BORDER_" ><sql:getColumn colName="SCHEME_DESC"/></td>
<td CLASS="BORDER_" align="right"><sql:getColumn colName="GROSS"/></td>
<td CLASS="BORDER_" align="right"><sql:getColumn colName="TDS"/></td>
<td CLASS="BORDER_" align="right" bgcolor="#e2d36d"><sql:getColumn colName="ADVANCE"/></td>
<td CLASS="BORDER_" align="right" bgcolor="#e2d36d"><sql:getColumn colName="PARTIAL"/></td>
<td CLASS="BORDER_" align="right"><sql:getColumn colName="NET"/></td>
</tr>
/////it give error here ///////////////////////////
<%
System.out.println(
%>
<sql:getColumn colName="SCHEME_DESC"/>
<%
);
%>
</sql:resultSet>
Whole code is As follows:
<%# include file="/include_session_check.jsp" %>
<%# include file="/include_db_tld.jsp" %>
<%#page import="java.util.ArrayList"%>
<center>
<%!
ArrayList<String> BankName_list=new ArrayList<String>();
%>
<%
String voucher="2012-2013/001188";
//com.GEN_Utility.nvl(request.getParameter("voucher"));
ArrayList<String> Scheme_list=new ArrayList<String>();
ArrayList<Float> Gross_List=new ArrayList<Float>();
ArrayList<Float> TDS_List=new ArrayList<Float>();
ArrayList<Float> Adv_List=new ArrayList<Float>();
ArrayList<Float> Partial_List=new ArrayList<Float>();
ArrayList<Float> Net_List=new ArrayList<Float>();
System.out.println(" voucher "+voucher);
%>
<br>
<DIV CLASS="PGBREAK" STYLE="background-color: white; WIDTH: 800px;">
<table width="793" height="70">
<TR>
<TD width="55%">
<img src="<%=STRpath%>index/Logo_new.bmp">
</TD>
<TD width="45%"><br><b>Mirae Asset Global Investments(I) Pvt Ltd</b> <br>
Unit No. 606, 6th Floor, Windsor Bldg.,<br>
Off CST Road, Kalina, Santacruz(E),<br>
Mumbai - 400 098.<br>
www.miraeassetmf.co.in
</TD>
</TR>
</table>
<hr width="793" noshade="true">
<sql:preparedStatement id="pst" conn="conn">
<sql:query>
SELECT DISTINCT A.VOUCHER_NO,A.DT_CASHFLOW,
TO_CHAR(A.AMT_FINAL,'99,99,99,99,990.00') AMT_FINAL,A.TDS,
TO_CHAR(A.AMT_ADJUST,'99,99,99,99,990.00') AMT_ADJUST,
TO_CHAR(A.AMT_NET,'99,99,99,99,990.00') AMT_NET,
TO_CHAR(A.AMT_ADVANCE,'99,99,99,99,990.00') AMT_ADVANCE,
TO_CHAR(A.AMT_PARTIAL,'99,99,99,99,990.00') AMT_PARTIAL,
A.EXPENSE_DESC,A.EXPENSE_CHARGE,A.ALLOCATION_PERIOD,
DECODE(B.ALLOCATION_ID,'7','(Quarterly AUM)',
'8',(SELECT (TO_CHAR(A.FROM_DT,'Mon-YYYY')||' - '||TO_CHAR(A.TO_DT,'Mon-YYYY')) ALLOCDT FROM DATA_AVG_AUM A, DATA_TRAN_BILL B
WHERE A.TRAN_ID = B.TRAN_ID
AND B.VOUCHER_NO='<%=voucher%>')) QTRAUM
FROM VW_VOUCHER_DETAIL A, DATA_TRAN_BILL B , MAST_ALLOCATION C
WHERE A.VOUCHER_NO = B.VOUCHER_NO
AND B.ALLOCATION_ID = C.ID
AND A.VOUCHER_NO='<%=voucher%>'
</sql:query>
<sql:resultSet id="rs">
<b>Approval Memo</b><br><br>
<table width="793" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid #6e6e6e;">
<tr>
<td colspan="4" valign="TOP" align="center">
<%--------------------------%>
<table width="98%" border="0" cellspacing="0" cellpadding="0" >
<tr bgcolor="#c5c5c5" style="height:20px">
<td width="10"> </td>
<td width="200" nowrap><b>Vocuher No.</b></td>
<td width="10">:</td>
<td width="0" colspan="5"><sql:getColumn colName="VOUCHER_NO"/></td>
</tr>
<tr>
<td> </td>
<td><b>Allocation Period</b></td>
<td>:</td>
<td><sql:getColumn colName="ALLOCATION_PERIOD"/> <sql:getColumn colName="QTRAUM"/></td>
<td> </td>
<td><b>Expense Type</b></td>
<td>:</td>
<td><sql:getColumn colName="EXPENSE_DESC"/></td>
</tr>
<tr>
<td> </td>
<td><b>Cash Flow Date</b></td>
<td>:</td>
<td><sql:getColumn colName="DT_CASHFLOW"/></td>
<td> </td>
<td><b>Expense Charge To</b></td>
<td>:</td>
<td><sql:getColumn colName="EXPENSE_CHARGE"/></td>
</tr>
<tr>
<td> </td>
<td><b>Gross Amount</b></td>
<td>:</td>
<td><sql:getColumn colName="AMT_FINAL"/></td>
</tr>
<tr>
<%-- <td> </td>
<td><b>Gross Amount</b></td>
<td>:</td>
<td><sql:getColumn colName="AMT_FINAL"/></td>
--%>
<td> </td>
<td><b>TDS (%)</b></td>
<td>:</td>
<td><sql:getColumn colName="TDS"/>%</td>
</tr>
<tr>
<td> </td>
<td><b>Adjusted Amount</b></td>
<td>:</td>
<td><sql:getColumn colName="AMT_ADJUST"/></td>
</tr>
<tr>
<td> </td>
<td><b>Advance/Partial</b></td>
<td>:</td>
<td><sql:getColumn colName="AMT_ADVANCE"/> / <sql:getColumn colName="AMT_PARTIAL"/></td>
<%-- <td> </td>
<td><b>Net Payable</b></td>
<td>:</td>
<td><sql:getColumn colName="AMT_NET"/></td> --%>
</tr>
<tr>
<td> </td>
<td><b>Net Payable</b></td>
<td>:</td>
<td><b><sql:getColumn colName="AMT_NET"/></b></td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td> </td>
<td><b>Narration</b></td>
<td>:</td>
<td colspan="5">
<sql:preparedStatement id="pst" conn="conn">
<sql:query>
SELECT PAYMENT_REMARKS FROM DATA_TRAN_BILL
WHERE VOUCHER_NO='<%=voucher%>'
</sql:query>
<sql:resultSet id="rs">
<sql:getColumn colName="PAYMENT_REMARKS"/>
</sql:resultSet>
</sql:preparedStatement>
</td>
</tr>
<!-- <tr>
<td colspan="4"> </td>
</tr>-->
<tr>
<td> </td>
<td><b>Scheme Allocation</b></td>
<td>:</td>
<td> </td>
</tr>
</table>
<%--------------------------%>
</td>
</tr>
<sql:preparedStatement id="pst" conn="conn">
<sql:query>
SELECT A.BANK_NAME,B.SCHEME_NAME SCHEME_DESC,
TO_CHAR(SUM(B.GROSS),'99,99,99,99,990.00') GROSS,
round(SUM(B.TDS),0) TDS,
TO_CHAR(SUM(B.ADVANCE),'99,99,99,99,990.00') ADVANCE,
TO_CHAR(SUM(B.PARTIAL),'99,99,99,99,990.00') PARTIAL,
TO_CHAR(SUM(B.NET),'99,99,99,99,990.00') NET
FROM VW_VOUCHER_ALLOCATION_DETAIL B, VW_SCHEME_ACCOUNT A
WHERE B.VOUCHER_NO='<%=voucher%>'
AND B.ID = A.EXPENSE_SCH_CODE
AND (B.GROSS>0 OR B.ADVANCE>0 OR B.PARTIAL>0)
GROUP BY A.BANK_NAME,B.SCHEME_NAME
ORDER BY A.BANK_NAME, B.SCHEME_NAME
</sql:query>
<tr>
<td colspan="4" align="center">
<%--------------------------%>
<DIV STYLE="height: 510px;" ID="fix">
<table width="750" border="0" cellspacing="1" cellpadding="0" style="border: 1px solid #6e6e6e;">
<tr bgcolor="#c5c5c5" style="height:20px;">
<td CLASS="BORDER_" style="border-bottom: 1px solid #6e6e6e;"><B>Custody Name</B></td>
<td CLASS="BORDER_" style="border-bottom: 1px solid #6e6e6e;"><B>Scheme Name</B></td>
<td CLASS="BORDER_" style="border-bottom: 1px solid #6e6e6e;"><B>Gross</B></td>
<td CLASS="BORDER_" style="border-bottom: 1px solid #6e6e6e;"><B>TDS</B></td>
<td CLASS="BORDER_" style="border-bottom: 1px solid #6e6e6e;"><B>Advance</B></td>
<td CLASS="BORDER_" style="border-bottom: 1px solid #6e6e6e;"><B>Partial</B></td>
<td CLASS="BORDER_" style="border-bottom: 1px solid #6e6e6e;"><B>Net</B></td>
</tr>
<sql:resultSet id="rs">
<tr style="height:20px">
<td CLASS="BORDER_"><b><sql:getColumn colName="BANK_NAME"/></b></td>
<td CLASS="BORDER_" ><sql:getColumn colName="SCHEME_DESC"/></td>
<td CLASS="BORDER_" align="right"><sql:getColumn colName="GROSS"/></td>
<td CLASS="BORDER_" align="right"><sql:getColumn colName="TDS"/></td>
<td CLASS="BORDER_" align="right" bgcolor="#e2d36d"><sql:getColumn colName="ADVANCE"/></td>
<td CLASS="BORDER_" align="right" bgcolor="#e2d36d"><sql:getColumn colName="PARTIAL"/></td>
<td CLASS="BORDER_" align="right"><sql:getColumn colName="NET"/></td>
</tr>
</sql:resultSet>
</sql:preparedStatement>
<%
for(int index=0;index<BankName_list.size();index++){
System.out.println("BankName_list "+BankName_list.get(index));
}
%>
<sql:preparedStatement id="pst" conn="conn">
<sql:query>
SELECT TO_CHAR(SUM(B.GROSS),'99,99,99,99,990.00') GROSS,
TO_CHAR(SUM(B.TDS),'99,99,99,99,990.00') TDS,
TO_CHAR(SUM(B.ADVANCE),'99,99,99,99,990.00') ADVANCE,
TO_CHAR(SUM(B.PARTIAL),'99,99,99,99,990.00') PARTIAL,
TO_CHAR(SUM(B.NET),'99,99,99,99,990.00') NET
FROM VW_VOUCHER_ALLOCATION_DETAIL B
WHERE B.VOUCHER_NO='<%=voucher%>'
AND (B.GROSS>0 OR B.ADVANCE>0 OR B.PARTIAL>0)
</sql:query>
<sql:resultSet id="rs">
<tr style="height:20px">
<td CLASS="BORDER_"> </td>
<td CLASS="BORDER_" align="right"><b>Grand Total </b></td>
<td CLASS="BORDER_" align="right"><b><sql:getColumn colName="GROSS"/></b></td>
<td CLASS="BORDER_" align="right"><b><sql:getColumn colName="TDS"/></b></td>
<td CLASS="BORDER_" align="right"><b><sql:getColumn colName="ADVANCE"/></b></td>
<td CLASS="BORDER_" align="right"><b><sql:getColumn colName="PARTIAL"/></b></td>
<td CLASS="BORDER_" align="right"><b><sql:getColumn colName="NET"/></b></td>
</tr>
</sql:resultSet>
</sql:preparedStatement>
<tr style="height:20px">
<td CLASS="BORDER_"> </td>
<td CLASS="BORDER_" align="right" colspan="2"><b>Adjusted Amount </b></td>
<td CLASS="BORDER_" colspan="5" align="right"><sql:getColumn colName="AMT_ADJUST"/></td>
</tr>
<tr style="height:20px" bgcolor="#c5c5c5">
<td CLASS="BORDER_"> </td>
<td CLASS="BORDER_" align="right" colspan="2"><b>Net Payable Amount </b></td>
<td CLASS="BORDER_" colspan="5" align="right"><b><sql:getColumn colName="AMT_NET"/></b></td>
</tr>
</sql:resultSet>
</sql:preparedStatement>
</table>
</DIV>
<%--------------------------%>
</td>
</tr>
<TFOOT>
<sql:preparedStatement id="pst" conn="conn">
<sql:query>
SELECT DECODE(CNT,1,
C.MAP_1 || ' ' ||
B.VENDOR_NAME,
' '
) DESCR
FROM
(
SELECT A.VOUCHER_NO,COUNT(DISTINCT(VENDOR_ID)) CNT,MAX(A.VENDOR_ID) VENDOR_ID,MAX(A.PAYMENT_MODE) PAYMENT_MODE
FROM DATA_TRAN_BILL A
GROUP BY A.VOUCHER_NO
) A,MAST_VENDOR B,MAST_PAYMENT_MODE C
WHERE A.VENDOR_ID=B.ID
AND A.PAYMENT_MODE=C.ID
AND A.VOUCHER_NO='<%=voucher%>'
</sql:query>
<sql:resultSet id="rs">
<TR>
<TD colspan="3" STYLE="font-size: 13px; "> <sql:getColumn colName="DESCR"/></TD>
</sql:resultSet>
</sql:preparedStatement>
<TD STYLE="font-size: 10px; ">
<DIV STYLE="height:60px; " ID="fix">
<sql:preparedStatement id="pst" conn="conn">
<sql:query>
SELECT DISTINCT V.BANK_NAME,V.ACC_NO,C.DESCR,V.IFSC_NEFT
FROM DATA_TRAN_BILL A,MAST_PAYMENT_MODE C, MAST_VENDOR V
WHERE A.PAYMENT_MODE = C.ID
AND A.VENDOR_ID = V.ID
AND C.DESCR IN ('NEFT','RTGS','RTGS/NEFT')
AND A.VOUCHER_NO = '<%=voucher%>'
</sql:query>
<sql:resultSet id="rs">
<table align="right" border="0" width="70%">
<tr>
<td>Bank Name : </td>
<td><sql:getColumn colName="BANK_NAME"/> </td>
</tr>
<tr>
<td>Account No. : </td>
<td><sql:getColumn colName="ACC_NO"/> </td>
</tr>
<tr>
<td><sql:getColumn colName="DESCR"/> Code : </td>
<td><sql:getColumn colName="IFSC_NEFT"/> </td>
</tr>
</table>
</sql:resultSet>
</sql:preparedStatement>
</DIV>
</TD>
</TR>
</TFOOT>
</table>
<br><br><br>
<table width="793" border="0" cellspacing="0" cellpadding="0">
<tr style="height:15px">
<td colspan="5"> </td>
</tr>
<tr align="center">
<td width="30"> </td>
<td width="153" style="border-top: 1px solid #6e6e6e;">Maker</td>
<td width="500"> </td>
<td width="153" style="border-top: 1px solid #6e6e6e;">Checker</td>
<td width="500"></td>
<td width="153" style="border-top: 1px solid #6e6e6e;">Approver</td>
<td width="30"> </td>
</tr>
</table><BR>
</DIV>
<BR>
</center>
<sql:closeConnection conn="conn"/>
The method println(boolean) in the type PrintStream is not applicable for the arguments
<sql:getColumn colName="SCHEME_DESC"/> is coming as empty here
There in no method is avaialable println with 0-arguments.
It seems you have mixed script lets and jstl tags together.
System.out.println( %><sql:getColumn colName="SCHEME_DESC"/><% ..
I am getting this error while I am trying to render a pdf. I am using Nicolas Leroux's PDF module for the play framework.
This is the entire stackstrace: Pastebin. Googling only reveals 4 results. They suggest removing any float properties, and position attributes, which I have removed, jsut to give it a try. I am still facing this problem. Has anyone been able to solve the issue?
EDIT: This is the html that renders the pdf:
#{extends 'main.html' /} #{set title:'Salary Details' /}
<html>
<head>
<title>Employee Name</title>
<style>
body {
font: 9pt Arial, Helvetica, sans-serif;
}
.container {
margin: 0 auto;
width: 1000px;
border: 1px solid black;
padding: 12px;
}
.logoClass {
width: 200px;
height: 85px;;
}
.companyAddressClass {
width: 60%;
margin: 0 auto;
font-size: 17px;
font-weight: bold;
text-align: center;
}
.empClass table {
width: 100%;
border: 1px solid #ccc;
border-collapse: collapse;
margin: 10px 0px;
}
.empClass table th,td {
border: 1px solid #ccc;
padding: 5px 5px;
}
.empClass table th {
background: #f2f2f2;
}
</style>
</head>
<body onload="window.print();">
%{for(int i=0;i<dataList.size ();i=i+1){}%
<div class="container" style="page-break-after:#{if i == dataList.size()-1} avoid;#{/if} #{else} always; #{/else}">
<div class="logoClass"></div>
<div class="companyAddressClass">
${dataList.get(i).distributorName},<br /> ${dataList.get(i).city},<br />
${dataList.get(i).state} <br /> <br /> <span>Payslip for the
month of ${dataList.get(i).salaryMonth}</span>
</div>
<br class="clear" />
<div class="empClass">
<table border="1">
<tr>
<td>Employee No: ${dataList.get(i).employeeNumber}</td>
<td>Location: ${dataList.get(i).location}</td>
</tr>
<tr>
<td>Name: ${dataList.get(i).employeeName}</td>
<td>Salary for the M/O: ${dataList.get(i).salaryMonth}</td>
</tr>
<tr>
<td>Bank Name: ${dataList.get(i).bankName}</td>
<td>Designation: ${dataList.get(i).designation}</td>
</tr>
<tr>
<td>Bank Acc No: ${dataList.get(i).accountNumber}</td>
<td>Join Date: ${dataList.get(i).joinDate}</td>
</tr>
<tr>
<td>PF No: ${dataList.get(i).pfNumber}</td>
<td>Gender: ${dataList.get(i).gender}</td>
</tr>
<tr>
<td>ESI No: ${dataList.get(i).esiNumber}</td>
<td>LOP: ${dataList.get(i).lop}</td>
</tr>
<tr>
<td>PAN No: ${dataList.get(i).panNumber}</td>
<td>Days Worked: ${dataList.get(i).daysWorked}</td>
</tr>
</table>
</div>
<br />
<div class="empClass">
<table border="1">
<tr>
<th colspan="3">Earnings</th>
<th colspan="2">Deductions</th>
</tr>
<tr>
<th align="left">Header</th>
<th align="right">Actual</th>
<th align="right">Paid</th>
<th align="left">Header</th>
<th align="right">Paid</th>
</tr>
<tr>
<td>Basic</td>
<td align="right">${dataList.get(i).basic}</td>
<td align="right">${dataList.get(i).basic}</td>
<td>PF</td>
<td align="right">${dataList.get(i).pf}</td>
</tr>
<tr>
<td>HRA</td>
<td align="right">${dataList.get(i).hra}</td>
<td align="right">${dataList.get(i).hra}</td>
<td>ESICEE</td>
<td align="right">${dataList.get(i).esicee}</td>
</tr>
<tr>
<td>Conveyance Allowance</td>
<td align="right">${dataList.get(i).conveynanceAllowance}</td>
<td align="right">${dataList.get(i).conveynanceAllowance}</td>
<td>ESICEE(PWS)</td>
<td align="right">${dataList.get(i).esiceePWS}</td>
</tr>
<tr>
<td>Medical Allowance</td>
<td align="right">${dataList.get(i).medicalAllowances}</td>
<td align="right">${dataList.get(i).medicalAllowances}</td>
<td>PT</td>
<td align="right">${dataList.get(i).pt}</td>
</tr>
<tr>
<td>Special Allowance</td>
<td align="right">${dataList.get(i).specialAllowance}</td>
<td align="right">${dataList.get(i).specialAllowance}</td>
<td>PT(PWS)</td>
<td align="right">${dataList.get(i).ptPWS}</td>
</tr>
<tr>
<td>Incentives</td>
<td align="right">${dataList.get(i).midMonthAmountPWS}</td>
<td align="right">${dataList.get(i).midMonthAmountPWS}</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Other Allowances</td>
<td align="right">${dataList.get(i).otherAllowance}</td>
<td align="right">${dataList.get(i).otherAllowance}</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="3" align="right">Total
Earnings:${dataList.get(i).totalEarnings}</td>
<td colspan="2" align="right">Total Deduction
:${dataList.get(i).totalDeduction}</td>
</tr>
<tr>
<td colspan="3"> </td>
<td colspan="2" align="right"><strong>Salary Credited
: ${dataList.get(i).salaryCredited}</strong></td>
</tr>
</table>
<table>
<thead>
<tr>
<th>Position Title</th>
<th>City Name</th>
<th>State Name</th>
</tr>
</thead>
<thead>
<tr>
..
..
..
..
<th>${dataList.get(i).positionTitle}</th>
<th>${dataList.get(i).cityName}</th>
<th>${dataList.get(i).stateName}</th>
</tr>
</thead>
</table>
<br>
<table>
<thead>
<tr>
<th>Some Header</th>
<th>Some Header</th>
<th>Some Header</th>
<th>Some Header</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">Values</td>
..
..
..
..
..
</tr>
</tbody>
</table>
</div>
<div>
<span style="font-size: 15px; font-weight: bold;"> Salary
Credited Amount(In Words): ${dataList.get(i).salaryCreditedInWord} </span>
</div>
</div>
<br />
<br />
%{}}%
</body>
</html>
I am using Windows 7 and Tomcat6 as the testing environment, the same environment that people over here are facing trouble with.
Thanks.
This commit is a fix for your problem. You can download the whole class and put it in your source code, so you haven't to rebuild the library jar.
If you are facing this issue, to fix this just add a span tag inside the td and add the style to that span tag. Example:
<td>
<span style = style="position: absolute;">
</td>
Basically if you add the style to the td, you would get the error because of the bug in fly saucer pdf.