I'm trying to write a code that stores images into database, then later display it on the webpage using the rollnum to retrieve it from the database. I've tried all i could but still no good, i tried reading some tutorials but still no good, anyways here's the code i'm working on. I'd be very grateful if someone could help, Thanks in Advance.
<%#page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration Page</title>
<style>
body{
background-image: url('bg.png');
background-repeat: repeat;
font-family: Courier New;
margin:auto;
width: 1000px;
}
.wrap{
margin-top:10px;
border:solid 1px #000;
height:900px;
}
.header{
font-size: 50px;
font-weight: bold;
font-family: Courier New;
text-align: center;
}
.border{
border-bottom: solid 1px #000;
margin-left: 30px;
margin-right: 30px;
}
.box{
border: solid 1px #000;
padding: 8px;
margin: 30px;
}
</style>
</head>
<body>
<div class="wrap">
<table>
<form method="post">
<br/>
<tr>
<td> Roll Number:</td> <td><input type="text" name="rollnum"/></td>
</tr>
</div>
<tr>
<td> First Name:</td> <td><input type="text" name="fname"/></td>
</tr>
<tr>
<td> Last Name:</td> <td><input type="text" name="lname"/></td>
</tr>
<tr>
<td> Course Name:</td> <td><input type="text" name="course"/></td>
</tr>
<tr>
<td> Gender:</td> <td>Male:<input type="radio" name="gender" value="Male"/> Female:<input type="radio" name="gender" value="Female"/></td>
</tr>
<tr>
<td> Address:</td> <td><input type="text" name="addr"/></td>
</tr>
<tr>
<td> State:</td> <td><input type="text" name="state"/></td>
</tr>
<tr>
<td> Photo:<input type="file" name="photo"/></td>
</tr>
<tr>
<td> <input type="submit" value="Submit" name="submit"/></td>
</tr>
</form>
</table>
<%
try{
if(request.getParameter("submit") != null){
Connection conn;
PreparedStatement prep;
String sql;
String url = "jdbc:derby://localhost:1527/reg";
Class.forName("org.apache.derby.jdbc.ClientDriver");
conn = DriverManager.getConnection(url,"uname","pass");
sql =
"insert into student (rollnum,fname,lname,course,gender,addr,state,photo)"
+"values(?,?,?,?,?,?,?,?)";
ResultSet rs = null;
prep = conn.prepareStatement(sql);
prep.setInt(1, Integer.parseInt(request.getParameter("rollnum")));
prep.setString(2, request.getParameter("fname"));
prep.setString(3, request.getParameter("lname"));
prep.setString(4, request.getParameter("course"));
prep.setString(5, request.getParameter("gender"));
prep.setString(6, request.getParameter("addr"));
prep.setString(7, request.getParameter("state"));
//prep.setString(8, request.getParameter("photo"));
Blob blob = rs.getBlob(request.getParameter("photo"));;
prep.setBlob(8, blob);
int n = prep.executeUpdate();
if(n>0){
%>
<div class="box">Registration Successful!! <b>Login Now!!</b></div>
<%
}
}
}
catch(ClassNotFoundException e){
}
catch(NumberFormatException n){
}
%>
</div>
</body>
You can follow this way:
Get the image
Convert the image with the base64 rappresentation
Store the base64 into your db
when you need the image convert again the base64 into the image
Related
From a jsp page I have to return xml data.
I fetch a record from the database and display in the Jsp. I have to return a display record in xml. And I have to do both display in jsp and same time return a record in xml.
I already did a display process and struck to return in xml:
<%
String selectsql = null;
DBConnection DBCon = null;
Connection Con = null;
String maprule = null;
PreparedStatement pstm = null;
ResultSet resultSet = null;
String snomedid = request.getParameter("snomedcode");
String snomedname = request.getParameter("snomednames");
try {
DBCon = new DBConnection();
Con = DBCon.getConnection();
selectsql = "SELECT referencedComponentId,sctName,mapTarget,icdName,mapRule,refid FROM snomedicd10map WHERE referencedComponentId=? or sctName=? ";
pstm = Con.prepareStatement(selectsql);
pstm.setString(1, snomedid);
pstm.setString(2, snomedname);
resultSet = pstm.executeQuery();
%>
<h2 align="center">
<font><strong>SNOMED CT TO ICD 10 </strong></font>
</h2>
<div style='min-height: 40px'>
<table id="tblMain" width="100%" class='table1' border=0
cellpadding='5' cellspacing='0' style='topmargin: -5px'>
<tr>
<td colspan='4' style='text-align: right;'>
<!-- <input type="button" value="Back" onclick="goback();" style="background-color: #3399ff;color:#ffffff" /> -->
<button onclick="goBack()" style="background-color: #3399ff;color:#ffffff">Back</button>
</td>
</tr>
<tr class='headerText' style='height: 25px'>
<td class='tdcellblue' style='width: 10%'>SNOMED</td>
<td class='tdcellblue' style='width: 40%'>SNOMED Name</td>
<td class='tdcellblue' style='width: 10%'>ICD-10</td>
<td class='tdcellblue' style='width: 40%'>ICD Name</td>
</tr>
<%
while (resultSet.next()) {
//String maprule = null;
maprule = (resultSet.getString("mapRule"));
if (maprule.matches("OTHERWISE TRUE")
|| maprule.matches("TRUE")) {
%>
<tr>
<td><%=resultSet.getString("referencedComponentId")%></td>
<td><%=resultSet.getString("sctName")%></td>
<td><%=resultSet.getString("mapTarget")%></td>
<td><%=resultSet.getString("icdName")%></td>
</tr>
<%
}
}
%>
</table>
</div>
<%
if(request.getParameter("hiderefineproblem")==null && maprule.matches("OTHERWISE TRUE")){ %>
<input type="button" value="Refine Problem" onclick="return showHide();" style="background-color: #3399ff;color:#ffffff;" />
<%}%>
<div id="showHideDiv" style="display: none;">
<p>Would one of the following diagnoses apply? Choose the most
specific one:</p>
<FORM ACTION="snomedMapping.jsp#newres" METHOD="POST">
<%
pstm = Con.prepareStatement(selectsql);
pstm.setString(1, snomedid);
pstm.setString(2, snomedname);
resultSet = pstm.executeQuery();
boolean bSubmit=false;
int refid=0;
String[] pipe=null;
while (resultSet.next()) {
refid=resultSet.getInt("refid");
pipe= resultSet.getString("mapRule").split("\\|");
if (pipe.length > 1){
bSubmit=true;
%>
<input type="radio" id="radioList" value="<%=refid%>" name="refId"/>
<tr><%=pipe[1]%></tr>
<br />
<%
}
}
%>
<%if(bSubmit){%>
<input type="hidden" name='hiderefineproblem' value='yes'/>
<INPUT TYPE="SUBMIT" value="Submit" style="background-color: #3399ff;color:#ffffff;">
<%}%>
</FORM>
</div>
<script>
function showHide() {
var ele = document.getElementById("showHideDiv")
if (ele.style.display == "block") {
ele.style.display = "none";
} else {
ele.style.display = "block";
}
}
/* function goback(){
window.location.href='/mobiledoc/jsp/catalog/xml/migration/snomedMapping/snomedIndex.jsp';
} */
function goBack() {
window.history.back();
}
</script>
<h2 align="center">
<font><strong></strong></font>
</h2>
<div style='min-height: 40px' id="newres">
<!-- <table id="tblMain" width="100%" class='table1' border=0
cellpadding='5' cellspacing='0' style='topmargin: -5px'>
<tr class='headerText' style='height: 25px'>
<td class='tdcellblue' style='width: 10%'>SNOMED</td>
<td class='tdcellblue' style='width: 40%'>SNOMED Name</td>
<td class='tdcellblue' style='width: 10%'>ICD-10</td>
<td class='tdcellblue' style='width: 40%'>ICD Name</td>
</tr> -->
<table>
<%
String str=request.getParameter("refId");
if(str.length()>0){
refid=Integer.parseInt(str);
//resultSet=Root.EcwCloseResultSet(resultSet);
//pstm=Root.EcwClosePreparedStatement(pstm);
selectsql = "SELECT * FROM snomedicd10map WHERE refid=?";
pstm = pstm = Con.prepareStatement(selectsql);
pstm.setInt(1,refid);
resultSet = pstm.executeQuery();
while (resultSet.next()) {
%>
<tr>
<td colspan='2' style='font-weight:bold;'>SNOMED</td>
</tr>
<tr>
<td><%=resultSet.getString("referencedComponentId")%> </td>
<td><%=resultSet.getString("sctName")%></td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td colspan='2' style='font-weight:bold;'>Target ICD</td>
</tr>
<tr>
<td><%=resultSet.getString("mapTarget")%> </td>
<td><%=resultSet.getString("icdName")%></td>
</tr>
<%
}
}
%>
</table>
</div>
<% }
How to implement it? I need to create one more page or in same page.
Instead of returning HTML text from the JSP, you just return XML text.
The code that is provided has HTML tags and JSP code to create the HTML document structure and content.
The XML version of the JSP will have XML tags and JSP code to create the XML document structure and content.
I am trying to identify the td value, the thing is inside TD i have input tag and i need to identify the value. My Td tag looks like below. I need to identify and get the value 4/11/2016. Trying to add the full source code
<div id="accountsSectionBottomContainer" class="acctBottom" default-path="/ui/app.php/AccountsBottomPane/21/acct_glance">
<div>
<div class="accountsModPLSQLReturn" data-aria-plsql-root="/ui/mod_plsql.php/aria/csrtools/" data-aria-plsql-url="dashboard_plan.plan_inst_unit_inst_dtls">
<div class="workbook_tabname">Accounts</div>
<script language="JavaScript" type="text/javascript"> self.focus(); </script>
<div id="account-name">
<style type="text/css"> .color-block dl { background-color: #F8F8FF; margin: 0; padding: 1em; } .white-block dl { font-size: 1.1em; margin: 0; padding: 1em; } .static-block dt { float: left; font-size: 1.1em; font-weight: bold; margin: 0; padding: 0; width: 300px; } .static-block dd { font-size: 1.1em; margin: 0 0 0 225px; padding: 0 0 5px 15px; } </style>
<script language="javascript" type="text/javascript"> $('.trgprdval').trigger('change'); var inFulfilmentStartDate_cal = new calendar3(document.main.inFulfillmentDate, "MM/DD/YYYY"); inFulfilmentStartDate_cal.year_scroll = true; inFulfilmentStartDate_cal.time_comp = false; function myCdidFunction() { var newCDID = document.getElementById('inClientDefinedIdentifier').value; document.getElementById('inNewCdid').value = newCDID; } function copyRadioVal(inputValue, origVal, inputName, name) { var hiddenValues = document.getElementsByClassName(name); console.log(inputName); console.log(name); console.log(document.getElementById(inputName)); x = document.getElementById(inputName).checked; if (x==true) { $("#"+origVal).val(inputValue); } } function copyCheckboxVal(inputValue, origVal, inputName, inPrimacyNo, inputId) { var x = document.getElementById(inputName).checked; if (x==true) { document.getElementById(origVal).value = inputValue; } if (x==false) { document.getElementById(origVal).value = ""; } var inputType = inPrimacyNo.concat(inputId); document.getElementById(inputType).value = inPrimacyNo; } function joinSelectVal(newInputName, oldInputId) { var selectval = document.forms["main"][oldInputId]; var selectedList = []; for (var i = 0; i < selectval.length; i++) { if (selectval[i].selected) { selectedList.push(selectval[i].value); } } var checkedStr = Array.join(selectedList, "~"); if (checkedStr.length == 0) { checkedStr = "NO#VALUE"; } document.getElementById(newInputName).value = checkedStr; } function validateInputsAndSubmit(button) { var valSuppFields = validateAcctSuppFields('.accountsForm'); if(!valSuppFields['isValid']) { alert(valSuppFields['errorMsg']); return false; } lockAndSubmitForm(button); } </script>
<div class="color-block">
<div class="white-block">
<form class="accountsForm" name="main" method="post" action="/ui/mod_plsql.php/aria/csrtools/dashboard_plan_m.plan_unit_instance_save_m" onsubmit="return false;">
<font size="3">
<br/>
<br/>
<table class="data-table clear-both" cellspacing="0">
<colgroup>
<tbody>
<tr>
<tr class="dataRow1 even">
<td valign="top" style="text-align: left;">
<td valign="top" style="text-align: left;">10089723</td>
<td valign="top" style="text-align: left;">Yes</td>
<td valign="top" style="text-align: left;">Invoiced</td>
<td valign="top" style="text-align: left;">
<input type="hidden" value="10089723" name="INSERVICES[0][inServiceNo]"/>
<input type="hidden" value="1" name="INSERVICES[0][inFulfillmentStatus]"/>
<input type="hidden" value="1" name="INSERVICES[0][inFulfillmentBasedInd]"/>
<input id="inFulfillmentDate10089723" type="text" readonly="readonly" value="4/11/2016" name="INSERVICES[0][inFulfillmentDate]"/>
</td>
</tr>
<tr class="dataRow1 even">
<td valign="top" style="text-align: left;">
<td valign="top" style="text-align: left;">10089726</td>
<td valign="top" style="text-align: left;">Yes</td>
<td valign="top" style="text-align: left;">Invoiced</td>
<td valign="top" style="text-align: left;">
<input type="hidden" value="10089726" name="INSERVICES[1][inServiceNo]"/>
<input type="hidden" value="1" name="INSERVICES[1][inFulfillmentStatus]"/>
<input type="hidden" value="1" name="INSERVICES[1][inFulfillmentBasedInd]"/>
<input id="inFulfillmentDate10089726" type="text" readonly="readonly" value="4/11/2016" name="INSERVICES[1][inFulfillmentDate]"/>
</td>
</tr>
<tr class="dataRow1 even">
<td valign="top" style="text-align: left;">
<td valign="top" style="text-align: left;">10089727</td>
<td valign="top" style="text-align: left;">Yes</td>
<td valign="top" style="text-align: left;">Invoiced</td>
<td valign="top" style="text-align: left;">
<input type="hidden" value="10089727" name="INSERVICES[2][inServiceNo]"/>
<input type="hidden" value="1" name="INSERVICES[2][inFulfillmentStatus]"/>
<input type="hidden" value="1" name="INSERVICES[2][inFulfillmentBasedInd]"/>
<input id="inFulfillmentDate10089727" type="text" readonly="readonly" value="4/11/2016" name="INSERVICES[2][inFulfillmentDate]"/>
</td>
</tr>
<tr class="dataRow1 even">
<td valign="top" style="text-align: left;">
<td valign="top" style="text-align: left;">10089730</td>
<td valign="top" style="text-align: left;">Yes</td>
<td valign="top" style="text-align: left;">Invoiced</td>
<td valign="top" style="text-align: left;">
<input type="hidden" value="10089730" name="INSERVICES[3][inServiceNo]"/>
<input type="hidden" value="1" name="INSERVICES[3][inFulfillmentStatus]"/>
<input type="hidden" value="1" name="INSERVICES[3][inFulfillmentBasedInd]"/>
<input id="inFulfillmentDate10089730" type="text" readonly="readonly" value="4/11/2016" name="INSERVICES[3][inFulfillmentDate]"/>
</td>
</tr>
<tr class="dataRow1 even">
<td valign="top" style="text-align: left;">
<td valign="top" style="text-align: left;">10089747</td>
<td valign="top" style="text-align: left;">Yes</td>
<td valign="top" style="text-align: left;">Invoiced</td>
<td valign="top" style="text-align: left;">
<input type="hidden" value="10089747" name="INSERVICES[4][inServiceNo]"/>
<input type="hidden" value="1" name="INSERVICES[4][inFulfillmentStatus]"/>
<input type="hidden" value="1" name="INSERVICES[4][inFulfillmentBasedInd]"/>
<input id="inFulfillmentDate10089747" type="text" readonly="readonly" value="4/11/2016" name="INSERVICES[4][inFulfillmentDate]"/>
</td>
</tr>
</tbody>
</table>
<br/>
<br/>
<font size="3">
<br/>
<br/>
<table class="simple" cellspacing="0">
<input type="hidden" value="8179" name="inPlanNo"/>
<input type="hidden" value="4066308" name="inPlanUnitInstanceNo"/>
<input id="inNewCdid" type="hidden" name="inClientDefinedIdentifier"/>
<input type="hidden" value="MasterPlan" name="inSelectedPlan"/>
<input type="hidden" value="19328197" name="inPlanInstanceNo"/>
<div class="form-buttons">
<input type="hidden" value="AAAAAAUJTTz9lWKS_TgqUANHCenOnmxH2IQHclhl2zoruTE55z7CFHIdaAAJNyGlNLLnb5f-97HVxpFchLgkkTjIFz9d_I_sKfI7EQd83gmsfyFtQA==" name="as_sfid"/>
<input type="hidden" value="yli8W38Xf7v_849HentO" name="as_fid"/>
</form>
</div>
</div>
</div>
<input id="inFulfillmentDate10089723" type="text" readonly="readonly" value="4/11/2016" name="INSERVICES[0][inFulfillmentDate]"/>
</td>
Hi in case you want to identify value="4/11/2016" you can directly use
in case of dynamic id plz use like
MyDynamicID = "//*[starts-with(#id,'inFulfillmentDate')]"
String value = driver.findElement(By.id(MyDynamicID )).getText();
now print string in the console
UPADTE
// our id = inFulfillmentDate pattern
List<WebElement> myDate = driver.findElements(By.xpath("//*[starts-with(#id,'inFulfillmentDate')]"));
System.out.println(myDate.size());
// now print all value
for(int i=0;i<myDate.size();i++){
System.out.println("value is : " +myDate.get(i).getAttribute("value"));
}
Belwo is the console output
6
value is : 4/11/2016
value is : 4/11/2016
value is : 4/11/2016
value is : 4/11/2016
value is : 4/11/2016
value is : 4/11/2016
In my jsp page i have following code snippet. This page is coming recursive way during my flow. I am getting a duplicate bean id error while execution of the jsp in the middle of the flow. Can you anyone help me how to check whether bean id already exist or not for the following code?
The full code has been given
code.jsp
<%# page language="java" %>
<%# page import="com.ubsw.risk.AUT_Authenticator.*" %>
<%
String path= System.getProperty("dev_property_path");
System.out.println("dev_property_path----->"+path);
%>
<jsp:useBean id="orbinfra" scope="session" class="com.ubsw.risk.Creation.web.OrbinfraBean" >
<jsp:setProperty name="orbinfra" property="propertiesFile" value="<%=path%>"/>
<%
System.out.println("B4 init of Orbinfra");
try {
orbinfra.init();
System.out.println("after init of Orbinfra");
} catch( Exception ex ) {
System.out.println("error in Orbinfra"+ex);
ex.printStackTrace();
%>
<html>
Caught exception while creating orbinfra <%= ex %>
</html>
<%
}
%>
</jsp:useBean>
<jsp:useBean id="security" scope="session" class="com.ubsw.risk.Creation.web.AuthenticatorBean" >
</jsp:useBean>
<%
boolean showLogin;
showLogin = true;
boolean additionalMessage = false;
String message = "Warning - Users login has expired";
boolean hasAdminRights = false;
// is there a command being sent
String checkcommand = request.getParameter("command");
// does user want to login
if( checkcommand != null ) {
if( checkcommand.equals("login") ) {
try {
String authenticatorModuleLookupValue= System.getProperty("authenticatorModuleLookupValue");
String cookieNamevalue= System.getProperty("cookieNamevalue");
System.out.println(request.getParameter("User_Name"));
System.out.println(request.getRemoteAddr());
System.out.println(request.getLocalAddr());
System.out.println("hello P");
//HttpSession session1 = request.getSession(true);
System.out.println(authenticatorModuleLookupValue+":"+cookieNamevalue);
security.setloginInfo(authenticatorModuleLookupValue,cookieNamevalue);
security.logon(request.getParameter("User_Name"), request.getParameter("Password"), request.getRemoteAddr(), response );
System.out.println("what happened?");System.out.println(security);
showLogin = false;
} catch( LogonFailure le ) {
additionalMessage = true;
message = "Logon failed : " + le.reason;
} catch( Exception ex ) {
additionalMessage = true;
message = "Failed, caught an exception : " + ex;
}
}
}
if( showLogin ) {
try {
showLogin = !security.hasPermission( request );
if( ! showLogin ) {
hasAdminRights = security.hasAdminPermission( request );
}
} catch( TicketIsExpired te ) {
additionalMessage = true;
message = "Warning - Users login has expired";
} catch( Exception ex ) {
additionalMessage = true;
message = "Exception - " + ex;
}
}
//System.out.println("showLogin"+showLogin);
// do we need to show login or not
if( showLogin ) {
%>
<html>
<body>
<FORM NAME="loginForm" ACTION="index.jsp" METHOD="post">
<center>
<%
if( additionalMessage ) {
%>
<b> <%= message %> </b><br>
<%
}
//System.out.println("showLogin"+showLogin);
%>
<br>
<br>
<center>
<table cellspacing="0" cellpadding="0" border="2" bordercolor="#60A0A0">
<INPUT TYPE='hidden' NAME='command' VALUE='login'>
<body>
<tr bgcolor="#60A0A0">
<td align="left" height="17"><font face="Verdana" color="white"><span
style="color: white; font-weight: bold; font-variant: normal; font-size: 10pt; text-align: left">
<center>
Creation Web Application
</center>
</span></font></td>
</tr>
<tr bgcolor="#60A0A0">
<td align="left" height="17"><font face="Verdana" color="white"><span
style="color: white; font-weight: bold; font-variant: normal; font-size: 10pt; text-align: left">Please
Login</span></font></td>
</tr>
<tr>
<td align="left" height="166">
<table border="0" height="116" width="460">
<tbody>
<tr>
<td height="16" width="70"></td>
<td height="16" width="87"></td>
<td height="16" width="164"></td>
<td height="16" width="136"></td>
</tr>
<tr>
<td height="25" width="70"></td>
<td height="25" width="87"><span
style="color: black; font-style: normal; font-family: Verdana; font-weight: bold; font-size: 10pt; text-align: center">Username:</span></td>
<td height="25" width="164"><input type="text"
name="User_Name" maxlength="20"
style="height: 25px; font-family: Verdana; width: 153px"></td>
</tr>
<tr>
<td height="1" width="70"></td>
<td height="1" width="87"></td>
<td height="1" width="164"></td>
<td height="1" width="136"></td>
</tr>
<tr>
<td height="25" width="70"></td>
<td height="25" width="87"><span
style="color: black; font-style: normal; font-family: Verdana; font-weight: bold; font-size: 10pt; text-align: center">Password:</span></td>
<td height="25" width="164"><input type="password"
name="Password"
style="height: 25px; font-family: Verdana; width: 153px"
maxlength="25"></td>
<td height="25" width="136"></td>
</tr>
<tr>
<td height="19" width="70"></td>
<td height="19" width="87"></td>
<td height="19" width="164"></td>
<td height="19" width="136"></td>
</tr>
<tr>
<td height="27" width="70"></td>
<td height="27" width="100"></td>
<td height="27" width="136">
<center><input type="submit" name="Login"
value="Login"
style="height: 25px; bottom: auto; right: auto; font-family: Verdana; background-color: #60A0A0; width: 62px; top: auto; left: auto"></center></td>
</tr>
<tr>
<td height="1" width="70"></td>
<td height="1" width="87"></td>
<td height="1" width="164"></td>
<td height="1" width="136"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</FORM>
</body>
</html>
<%
return;
}
%>
As you are saying This page is coming recursive way during my flow.
Try changing scope="page" to scope="request"
Or try renaming beanId to "orbinfra1"
<jsp:useBean id="orbinfra1" scope="session" class="com.ubsw.risk.Creation.web.OrbinfraBean" >
<jsp:setProperty name="orbinfra1" property="propertiesFile" value="<%=path%>"/>
</jsp:useBean>
I am looking for any GWT grid widget that needs to have row and column headers on X and Y axis. Those needs to be seamlessly scrollable across X and Y axis.
Essentially I am looking for a GWT widget as demonstrated in the below URL
jsfiddle.net/jschlick/Gv26h/
We need to prifix with http:// in the above URL. The above is completely implemented in Java script.
Is there any GWT widget available with above functionality?
Any help would be really appreciated.
<html>
<header>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
body, input {
/*font: 15px/1em Arial, Helvetica, sans serif;*/
}
-webkit-scrollbar {
height: 7px;
width: 7px;
-webkit-appearance: none;
}
-webkit-scrollbar-thumb {
background-color: rgba(0,0,0,.5);
border-radius: 4px;
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
#divHeader {
border-bottom: 1px solid #d7d7d7;
overflow: hidden;
padding: 0 0 5px 0;
width: 284px;
}
#firstcol {
border-right: 1px solid #d7d7d7;
height: 200px;
overflow: hidden;
padding: 0 10px;
}
#table_div {
height: 210px;
overflow: scroll;
position: relative;
width: 300px;
}
#table_div td {
}
</style>
<script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
fnAdjustTable();
});
fnAdjustTable = function(){
var colCount = $('#firstTr>td').length; //get total number of column
var m = 0;
var n = 0;
var brow = 'mozilla';
jQuery.each(jQuery.browser, function(i, val) {
if(val == true){
brow = i.toString();
}
});
$('.tableHeader').each(function(i){
if (m < colCount){
if (brow == 'mozilla'){
$('#firstTd').css("width",$('.tableFirstCol').innerWidth());//for adjusting first td
$(this).css('width',$('#table_div td:eq('+m+')').innerWidth());//for assigning width to table Header div
}
else if (brow == 'msie'){
$('#firstTd').css("width",$('.tableFirstCol').width());
$(this).css('width',$('#table_div td:eq('+m+')').width()-2);//In IE there is difference of 2 px
}
else if (brow == 'safari'){
$('#firstTd').css("width",$('.tableFirstCol').width());
$(this).css('width',$('#table_div td:eq('+m+')').width());
}
else {
$('#firstTd').css("width",$('.tableFirstCol').width());
$(this).css('width',$('#table_div td:eq('+m+')').innerWidth());
}
}
m++;
});
$('.tableFirstCol').each(function(i){
if(brow == 'mozilla'){
$(this).css('height',$('#table_div td:eq('+colCount*n+')').outerHeight());//for providing height using scrollable table column height
}
else if(brow == 'msie'){
$(this).css('height',$('#table_div td:eq('+colCount*n+')').innerHeight()-2);
}
else {
$(this).css('height',$('#table_div td:eq('+colCount*n+')').height());
}
n++;
});
}
//function to support scrolling of title and first column
fnScroll = function(){
$('#divHeader').scrollLeft($('#table_div').scrollLeft());
$('#firstcol').scrollTop($('#table_div').scrollTop());
}
</script>
</header>
<body>
<table cellspacing="0" cellpadding="0" border="1" >
<tr>
<td id="firstTd">
</td>
<td>
<div id="divHeader">
<table cellspacing="0" cellpadding="10" border="1">
<tr>
<td>
<div class="tableHeader">28</div>
</td>
<td>
<div class="tableHeader">30</div>
</td>
<td>
<div class="tableHeader">32</div>
</td>
<td>
<div class="tableHeader">34</div>
</td>
<td>
<div class="tableHeader">36</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td valign="top">
<div id="firstcol">
<table cellspacing="0" cellpadding="10" border="1">
<tr>
<td class="tableFirstCol">32</td>
</tr>
<tr>
<td class="tableFirstCol">32.5</td>
</tr>
<tr>
<td class="tableFirstCol">33</td>
</tr>
<tr>
<td class="tableFirstCol">33.5</td>
</tr>
<tr>
<td class="tableFirstCol">34</td>
</tr>
<tr>
<td class="tableFirstCol">34.5</td>
</tr>
<tr>
<td class="tableFirstCol">36</td>
</tr>
<tr>
<td class="tableFirstCol">36.5</td>
</tr>
<tr>
<td class="tableFirstCol">38</td>
</tr>
</table>
</div>
</td>
<td valign="top">
<div id="table_div" onscroll="fnScroll()" >
<table width="500px" cellspacing="0" cellpadding="10" border="1">
<tr id="firstTr">
<td>Row1Col1</td>
<td>Row1Col2</td>
<td>Row1Col3</td>
<td>Row1Col4</td>
<td>Row1Col5</td>
</tr>
<tr>
<td>Row2Col1</td>
<td>Row2Col2</td>
<td>Row2Col3</td>
<td>Row2Col4</td>
<td>Row2Col5</td>
</tr>
<tr>
<td>Row3Col1</td>
<td>Row3Col2</td>
<td>Row3Col3</td>
<td>Row3Col4</td>
<td>Row3Col5</td>
</tr>
<tr>
<td>Row4Col1</td>
<td>Row4Col2</td>
<td>Row4Col3</td>
<td>Row4Col4</td>
<td>Row4Col5</td>
</tr>
<tr>
<td>Row5Col1</td>
<td>Row5Col2</td>
<td>Row5Col3</td>
<td>Row5Col4</td>
<td>Row5Col5</td>
</tr>
<tr>
<td>Row6Col1</td>
<td>Row6Col2</td>
<td>Row6Col3</td>
<td>Row6Col4</td>
<td>Row6Col5</td>
</tr>
<tr>
<td>Row7Col1</td>
<td>Row7Col2</td>
<td>Row7Col3</td>
<td>Row7Col4</td>
<td>Row7Col5</td>
</tr>
<tr>
<td>Row8Col1</td>
<td>Row8Col2</td>
<td>Row8Col3</td>
<td>Row8Col4</td>
<td>Row8Col5</td>
</tr>
<tr>
<td>Row9Col1</td>
<td>Row9Col2</td>
<td>Row9Col3</td>
<td>Row9Col4</td>
<td>Row9Col5</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
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.