I want to know what's wrong in this code.
I have a list of date and the second list contain others values.
I'm trying to put all date in the list "daStock" and others values (line,category,duration) in list "stockss". I have a table in my page jsp. I want every date display with his own values.
<%#page import="model.Stock"%>
<%#page import="model.Operateur"%>
<%#page import="model.Descriptionarret"%>
<%#page import="model.Categoriearret"%>
<%#page import="web.Operation"%>
<%#page import="web.UhtBeans"%>
<%#page import="model.Ligne"%>
<%#page import="java.text.DateFormat"%>
<%#page import="java.text.SimpleDateFormat"%>
<%#page import="java.util.Date"%>
<%#page import="java.util.ArrayList"%>
<%#page import="java.util.Iterator"%>
<%# page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html >
<head >
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="MWH Team 2" />
<script type="text/javascript" src="fichier/jquery-1.10.2.js"></script>
<script type="text/javascript" src="jquery-ui-1.11.0/jquery-ui.js"></script>
<script type="text/javascript" src="fichier/ajax_js.js"></script>
<script type="text/javascript" src="fichier/calendrier.js"></script>
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="fichier/design.css" />
<link href="./fichier/bootstrap.min.css" rel="stylesheet">
<link href="./fichier/Site.css" rel="stylesheet">
<link rel="stylesheet" href="jquery-ui-1.11.0/jquery-ui.css">
<title>UHT</title>
<script language="javascript">
function showList() {
var select = document.getElementById('liste');
if(select.value == "l1") {
document.getElementById('l1').setAttribute('style','visibility:inline');
} else if(select.value == "l2") {
document.getElementById('l2').setAttribute('style','visibility:inline');
} else {
document.getElementById('l3').setAttribute('style','visibility:inline');
}
}
</script>
</head>
<body >
<script language="JavaScript" type="text/javascript">
function getsupport ( )
{
document.SupportForm.submit() ;
}
</script>
<%
Operateur p = new Operateur();
String info="";
String info1="";
String info2="";
if (session.getAttribute("oppp")==null){%>
<SCRIPT LANGUAGE='JavaScript'>
window.alert('Veuillez vous identifier');
window.location.href='Connexion.jsp';
</SCRIPT>
<% } else {
p = (Operateur) session.getAttribute("oppp");
if (p.getIsadmin().equals("false"))
{
info = p.getNomoperateur();
info2="Operateur";
info1="opera";
}
else
{
info = p.getNomoperateur();
info2="Administrateur";
info1="admin";
}
}
%>
<script language="JavaScript" type="text/javascript">
function getsupport ( )
{
document.SupportForm.submit() ;
}
</script>
<div style="padding-bottom:30px; margin-top:-10px; background-color: green; background-image: url('./fichier/occpp.png');
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
" >
<div> <label style="margin-left:1150px; margin-top:30px; margin-right: 2px; color:#ffffff; font-family: Calibri, sans-serif; "><%=info %><br/><%=info2 %></label></div>
<p style="color:#ffffff; font-size:36px; font-family: Coolvetica Rg;" align="center">Cute Process UHT</p>
</div>
<div class="row-offcanvas row-offcanvas-left">
<div id="sidebar" class="sidebar-offcanvas" style="margin-top:18px; ">
<form name="SupportForm" method="post" action="controle">
<input type="hidden" name="Adminpanel4" />
<ul class="nav nav-pills nav-stacked">
<li>Acceuil</li>
<li class="active">Saisie des Données</li>
<li class="active">Resultats</li>
<li id="Adminpanel" >Gestion des Lignes</li>
<li id="Adminpanel1">Gestion des Categories</li>
<li id="Adminpanel2">Gestion des Arrêts</li>
<li id="Adminpanel3">Gestion des Operateurs</li>
<li>Deconnexion</li>
</ul>
</form>
</div>
<button class="sidebar-trigger" data-toggle="offcanvas" style="margin-top:18px;"></button>
<div id="main">
<div class=" container-fluid body-content " style="margin-top:10px; ">
<%
UhtBeans uhtBs;
Operation opp = new Operation();
uhtBs = new UhtBeans();
uhtBs.setListeLi(opp.allLigne());
uhtBs.setListeCat(opp.allCategorie());
uhtBs.setListeArr(opp.allArret());
%>
<input type="hidden" name="isSent" id="InputisSent" />
<input type="hidden" id="oop" value="<%=info1 %>" /></td>
<br /><br />
<center>
<h2 align="center" class="button green center" data-toggle="collapse" data-target="#Gestion1" >List</h2>
<br><br>
<center id="Gestion1" class="collapse">
<div id="affichage" style="overflow:auto;">
<script type="text/javascript">
var tableToExcel = (function() {
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
return function(table, name) {
if (!table.nodeType) table = document.getElementById(table)
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
window.location.href = uri + base64(format(template, ctx))
}
})()
</script>
<div id="export" ><input type="button" onclick="tableToExcel('testTable2', 'W3C Example Table')" value=" Export to Excel ">
</div>
<p></p>
<center>
<table border="1" id="testTable2" border="1" width=100% class="table table-hover">
<thead>
<tr align="center" >
<th width="50%">Postes</th>
<th>Poste1 (22h-06h)</th>
<th>Poste2 (06h-14h)</th>
<th>Poste3 (14h-22h)</th>
<th>Total Journé</th>
</tr>
</thead>
<%
UhtBeans ub = new UhtBeans();
UhtBeans ub1 = new UhtBeans();
ub.setListDateSt(opp.allDateStock());
ub1.setListSt(opp.allStock());
request.setAttribute("DateStock", ub);
request.setAttribute("stock", ub1);
UhtBeans stockss;
UhtBeans daStock;
daStock = (UhtBeans) request.getAttribute("DateStock");
if(request.getAttribute("stock") != null){
stockss =(UhtBeans) request.getAttribute("stock");
}else {
Operation opers = new Operation();
stockss = new UhtBeans();
stockss.setListSt(opers.allStock());
}
%>
<%
Iterator<Stock> listDat = daStock.getListDateSt().iterator();
while(listDat.hasNext()){
Stock sd =listDat.next();
Iterator<Stock> lists = stockss.getListSt().iterator();
while(lists.hasNext()){
Stock s =lists.next();
%>
<tr>
<th bgcolor="green" class="Date"><%=s.getDate() %></th>
</tr>
<tr align="center" bgcolor="cyan">
<th>DIAGRAMME TEMPS</th>
<th>Durée(min)</th>
<th>Durée(min)</th>
<th>Durée(min)</th>
<th>Durée(min)</th>
</tr>
<tbody id="colonne">
<tr align="center">
<th bgcolor="yellow">Temps Calendrier</th>
<%int d=480; %>
<th id="d" class="Duree"><%=d %></th>
<th ></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Temps non disponible</th>
<th class="Duree" id="d11"><%
System.out.println("ID DU CATEGORIE EST : "+s.getCategorie());
if (s.getCategorie().equals("0")){
%>
<%=s.getDuree() %>
<%} %>
</th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center">
<th bgcolor="yellow">Temps Disponible</th>
<%int d2;
d2=d; %>
<th><%=d2 %></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Temps disponible non utilisé</th>
<th class="Duree">
<%System.out.println("ID De TDNU EST : "+ s.getCategorie());
if(s.getCategorie().equals("1")){
%><%=s.getDuree()%>
<%} %>
</th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center">
<th bgcolor="yellow">Temps d'ouverture</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Préventif et révision équipement</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Autres arrêts planifiés non OP</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center">
<th bgcolor="yellow">Temps operationnel</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Nettoyage</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Autres arrêts OP planifiés</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center">
<th bgcolor="yellow">Temps de production</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Arrêts organisationnels</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Arrêts techniques</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="right">
<th bgcolor="red">Arrêts technologiques</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center">
<th bgcolor="yellow">Running time</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center">
<th bgcolor="yellow">Temps net de production</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<%
}}
%>
</tbody>
<tr><th colspan="5"><br></th></tr>
<tr align="center" bgcolor="cyan">
<th>INDICATEURS DU CUTE</th>
<th colspan="4">Valeur</th>
</tr>
<tr align="center" bgcolor="green">
<th>Efficacité de production (PE)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center" bgcolor="green">
<th>Efficacité operationnelle (OE)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center" bgcolor="green">
<th>Efficacité énèrgetique (EE)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center" bgcolor="green">
<th>Maintenance planifiée (PM)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center" bgcolor="green">
<th>Nettoyage planifié (CIP)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center" bgcolor="green">
<th>Arrêts techniques (th)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center" bgcolor="green">
<th>Arrêts technologiques (TOD)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr align="center" bgcolor="green">
<th>Utilisation operationnelle (OU)</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
</table>
</center>
</div>
</center>
<script>
$('#InputOperateurMail').on("click", function () {
// $('#CC').val($(this).val());
$('#CC').val($('#CC').val()+";"+$(this).val());
});
$( "#InputDate" ).datepicker({
changeMonth: true,
changeYear: true
});
//Le script Ajaaaaaaaaaaaaaaaaaax
$(document).ready(function() {
if ( $("#oop").val()!="admin")
{
$("#Adminpanel").hide();
$("#Adminpanel1").hide();
$("#Adminpanel2").hide();
$("#Adminpanel3").hide();
$("#export").hide();
}
var selectionCount = 1;
$('#Ajouter').on("click", function () {
$.ajax({
type: "GET",
url: "controle?action=Ajouter",
data: {
Date: $("#InputDate").val(),
NomCat: $("#InputNomCat").val(),
Arret: $("#InputArrets option:selected").val(),
Ligne: $("#InputLigne").val(),
Duree: $("#InputDuree").val(),
},
success: function (result) {
$("#affichage").html(result);
}
});
});
//Modifier
$('#Modifier').on("click", function () {
$.ajax({
type: "GET",
url: "controle?action=Modifier",
data: {
Date: $("#InputDate").val(),
NomCat: $("#InputNomCat").val(),
Arret: $("#InputArrets").val(),
Ligne: $("#InputLigne").val(),
Duree: $("#InputDuree").val(),
},
success: function (result) {
$("#affichage").html(result);
}
});
});
//Supprimer
$('#Supprimer').on("click", function () {
$.ajax({
type: "GET",
url: "controle?action=Supprimer",
data: {
Date: $("#InputDate").val(),
NomCat: $("#InputNomCat").val(),
Arret: $("#InputArrets").val(),
Ligne: $("#InputLigne").val(),
Duree: $("#InputDuree").val(),
},
success: function (result) {
$("#affichage").html(result);
}
});
});
//Recherche
$('#Rechercher').on("click", function () {
$("#Retourner").attr('type', 'submit');
$("#Rechercher").attr('type', 'hidden');
$.ajax({
type: "GET",
url: "controle?action=Rechercher",
data: {
Date: $("#InputDate").val(),
},
success: function (result) {
$("#affichage").html(result);
}
});
});
//retourner Affichage
$('#Retourner').on("click", function () {
$("#Retourner").attr('type', 'hidden');
$("#Rechercher").attr('type', 'submit');
$.ajax({
type: "GET",
url: "controle?action=Retourner",
success: function (result) {
$("#affichage").html(result);
}
});
});
//Vider les Inputs
$('#Vider').on("click", function () {
$("#InputDate").val("");
$("#InputNomCat").val("");
$("#InputArrets").val("");
$("#InputLigne").val("");
$("#InputDuree").val("");
});
//Affichage des valeurs dans les Inputs
$('#affichage').on("click", 'tbody tr', function () {
if ($(this).hasClass('selected')) {
selectionCount++;
selectionCount = 1;
}
if (selectionCount == 1) {
$(".selected").removeClass("selected");
$(this).addClass("selected");
var Date = $('.selected').find(".Date").text().trim();
var NomCat = $('.selected').find(".NomCat").text().trim();
var Arret = $('.selected').find(".Arret").text().trim();
var Ligne = $('.selected').find(".Ligne").text().trim();
var Duree = $('.selected').find(".Duree").text().trim();
//changement du couleur
$('#colonne tr').css('background','white');
$("#InputDate").val(Date) ;
$("#InputNomCat").val(NomCat);
$("#InputArrets").val(Arret);
$("#InputLigne").val(Ligne);
$("#InputDuree").val(Duree);
}
});
//Affichage des valeurs dans les Inputs
var i=1;
$( "#espacefournisseur" ).hide();
$( "#espaceF" ).click(function() {
if(i % 2 == 0)
{ $( "#espacefournisseur" ).hide( "slow");
i=i+1;
}else
{ $( "#espacefournisseur" ).show( "slow");
i=i+1;
}});
});
</script>
<!-- Date Pickeeeeeeeer! -->
<!-- Tableau obligatoire ! C'est lui qui contiendra le calendrier ! -->
<table class="ds_box" cellpadding="0" cellspacing="0" id="ds_conclass" style="display: none;">
<tr>
<td id="ds_calclass"></td>
</tr>
</table>
<script type="text/javascript" src="fichier/bootstrap.js"></script>
<script src="fichier/Site.js"></script>
</div>
</div>
</div>
</body>
</html>
Error
SEVERE: Servlet.service() for servlet [jsp] in context with path [/Stage-UHT1] threw exception [An exception occurred processing JSP page /Resultats.jsp at line 222
219: <%
220: Iterator<Stock> listDat = daStock.getListDateSt().iterator();
221: while(listDat.hasNext()){
222: Stock sd =listDat.next();
223: Iterator<Stock> lists = stockss.getListSt().iterator();
224: while(lists.hasNext()){
225: Stock s =lists.next();
Stacktrace:] with root cause
java.lang.ClassCastException: java.lang.String cannot be cast to model.Stock
at org.apache.jsp.Resultats_jsp._jspService(Resultats_jsp.java:310)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
UhtBeans CLass
package web;
import java.util.ArrayList;
import java.util.List;
import model.Categoriearret;
import model.Descriptionarret;
import model.Ligne;
import model.Operateur;
import model.Stock;
public class UhtBeans {
private Ligne ligne = new Ligne() ;
private Categoriearret categorie = new Categoriearret();
private Descriptionarret arret = new Descriptionarret();
private Stock stock = new Stock();
private Operateur operateur = new Operateur();
private boolean login;
private ArrayList<Ligne> listeLi = new ArrayList<Ligne>();
private ArrayList<Categoriearret> listeCat = new ArrayList<Categoriearret>();
private ArrayList<Descriptionarret> listeArr = new ArrayList<Descriptionarret>();
private ArrayList<Stock> listSt = new ArrayList<Stock>();
private ArrayList<Stock> listDateSt = new ArrayList<Stock>();
private ArrayList<Operateur> listOp = new ArrayList<Operateur>();
public ArrayList<Stock> getListDateSt() {
return listDateSt;
}
public void setListDateSt(List<Stock> listDateSt) {
this.listDateSt = (ArrayList<Stock>) listDateSt;
}
//Operateur
public Operateur getOperateur() {
return operateur;
}
public void setOperateur(Operateur operateur) {
this.operateur = operateur;
}
public ArrayList<Operateur> getListOp() {
return listOp;
}
public void setListOp(List<Operateur> listOp) {
this.listOp = (ArrayList<Operateur>) listOp;
}
//Stock
public Stock getStock() {
return stock;
}
public void setStock(Stock stock) {
this.stock = stock;
}
public ArrayList<Stock> getListSt() {
return listSt;
}
public void setListSt(List<Stock> list) {
this.listSt = (ArrayList<Stock>) list;
}
//Arrêt
public Descriptionarret getArret() {
return arret;
}
public void setArret(Descriptionarret arret) {
this.arret = arret;
}
public ArrayList<Descriptionarret> getListeArr() {
return listeArr;
}
public void setListeArr(List<Descriptionarret> listeArr) {
this.listeArr = (ArrayList<Descriptionarret>)listeArr;
}
//Categories
public Categoriearret getCategorie() {
return categorie;
}
public void setCategorie(Categoriearret categorie) {
this.categorie = categorie;
}
public ArrayList<Categoriearret> getListeCat() {
return listeCat;
}
public void setListeCat(List<Categoriearret> listCat) {
this.listeCat = (ArrayList<Categoriearret>)listCat;
}
//Lignes
public Ligne getLigne() {
return ligne;
}
public void setLigne(Ligne ligne) {
this.ligne = ligne;
}
public ArrayList<Ligne> getListeLi() {
return listeLi;
}
public void setListeLi(List<Ligne> listeLi) {
this.listeLi = (ArrayList<Ligne>)listeLi;
}
public boolean isLogin() {
return login;
}
public void setLogin(boolean login) {
this.login = login;
}
}
I think stockss.getListSt() returns a list of String. So casting an element of the list to a Stock cannot possibly work. And that's what you're trying to do in Stock s =lists.next();
Related
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.
I am developing an application with AngularJS and Spring MVC. Everything is working fine but my object is going as null to the Spring Controller so it's returning null. I just don`t know how to make the AngularJS populates the object.
I will post the code here.
AngularJS
<%#taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>
<%#taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%#taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!doctype html>
<html>
<head>
<title>Settings</title>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/workflow.css">
<link rel="stylesheet" href="css/upload.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="shortcut icon" href="images/logo-small.png" />
</head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('formSubmit', []);
app.controller('FormSubmitController', function($scope, $http) {
$scope.formData = {};
$scope.headerText = 'AngularJS Post Form Spring MVC example: Submit below form';
$scope.submit = function() {
var formData = {
"name1" : "nome 1",
"name2" : "nome 2",
"name3" : "nome 3",
};
var response = $http.post('http://localhost:8080/fire-fatca-web/SubmitMock.html', formData); //passing mockForm
response.success(function(data, status, headers, config) {
/* alert('Success!' + JSON.stringify({
data: $scope.formData //used formData model here
}) ); */
$scope.mockForm = data;
$scope.formData.push(data);
});
response.error(function(data, status, headers, config) {
alert("Exception details: " + JSON.stringify({
data: $scope.formData //used formData model here
}));
})
};
});
</script>
<style>
input.ng-invalid {
border: 2px red solid;
}
</style>
<body data-ng-app="formSubmit">
<div class="container">
<div class="col-sm-8 col-sm-offset-2">
<form data-ng-submit="submit()" name="myForm" data-ng-controller="FormSubmitController">
<!-- novalidate prevents HTML5 validation since we will be validating ourselves -->
<table border="1">
<tr>
<td colspan="2">
<label>Name Line 1:</label>
</td>
</tr>
<tr>
<td colspan="2">
<div class="form-group">
<input type="text" name="name1" class="form-control" data-ng-model="formData.name1" required ng-Maxlength="40">
<p ng-show="myForm.name1.$error.required" class="help-block">Name is required.</p>
<p ng-show="myForm.name1.$error.maxlength" class="help-block">Maximum 40 characters</p>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<label>Name Line 2:</label>
</td>
</tr>
<tr>
<td colspan="2">
<div class="form-group">
<input type="text" name="name2" class="form-control" data-ng-model="formData.name2" ng-Maxlength="40">
<p ng-show="myForm.name2.$error.maxlength" class="help-block">Maximum 40 characters</p>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<label>Name Line 3:</label>
</td>
</tr>
<tr>
<td colspan="2">
<div class="form-group">
<input type="text" name="name3" class="form-control" data-ng-model="formData.name3" ng-Maxlength="40">
<p ng-show="myForm.name3.$error.maxlength" class="help-block">Maximum 40 characters</p>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<h4>You submitted below data through post:</h4>
<pre>Form data ={{formData}}</pre>
</td>
</tr>
<tr>
<td colspan="2">
<p>Response: {{mockForm}}</p>
</td>
</tr>
<tr>
<td colspan="2">
<!-- SUBMIT BUTTON -->
<button type="submit" class="btn btn-primary" ng-disabled="myForm.$invalid">Submit</button>
</td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
Spring Controller
#Controller
public class MockController {
private Logger log = LoggerFactory.getLogger(MockController.class);
#RequestMapping("/mock")
public String getSettingsPage(){
return "mock";
}
#RequestMapping(value = "/SubmitMock", method = RequestMethod.POST)
public #ResponseBody String getMock(#RequestBody MockForm mockForm){
StringBuilder reponseData = new StringBuilder();
reponseData.append("Name1: "+ mockForm.getName1()+" ");
reponseData.append("Name2: "+ mockForm.getName2()+" ");
reponseData.append("Name3: "+ mockForm.getName3());
log.debug(reponseData.toString());
return reponseData.toString();
}
The return is aways: Name1: null, Name2: null and Name3: null
I know that I need to populate my mockForm with my formData. It was suggested me to do this:
var response = $http.post('http://localhost:8080/fire-fatca-web/SubmitMock.html', {mockform: formData});
But when I use that piece of code above my Controller Stops responding, I don't know why, maybe Sintaxe Error, I have no idea. Any help?
EDIT:
MockForm.java
package com.opessoftware.beans;
public class MockForm {
private String name1;
private String name2;
private String name3;
public String getName1() {
return name1;
}
public void setName1(String name1) {
this.name1 = name1;
}
public String getName2() {
return name2;
}
public void setName2(String name2) {
this.name2 = name2;
}
public String getName3() {
return name3;
}
public void setName3(String name3) {
this.name3 = name3;
}
}
EDIT 2:
Finally I solve the problem. my ng-data-model was formData.name1, formData.name2 and formData.name3. I changed for name1, name2 and name3. Problem solved. Thank you all!
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 deployed my project on the production server and getting the below error.
It's a live project so , after getting error i replaced this with previous version that was running fine but now that is also throwing the same error.Please suggest me what could be the problem ?
error:
HTTP Status 500 - org.apache.jasper.JasperException: java.lang.NullPointerException
--------------------------------------------------------------------------------
type Exception report
message org.apache.jasper.JasperException: java.lang.NullPointerException
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:709)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:680)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.LPSSuppIndex_jsp._jspService(LPSSuppIndex_jsp.java:393)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
org.apache.jsp.error_jsp._jspService(error_jsp.java:124)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:709)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:680)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.LPSSuppIndex_jsp._jspService(LPSSuppIndex_jsp.java:393)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.36 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.36
IndexPage.jsp :
<%# page errorPage="error.jsp"%>
<%# page import="java.util.*" %>
<%# page import = "jdbc.RetrieveLangList,lang.MessageGetter" %>
<%!
HashMap<String, String> langListMap = new HashMap<String, String>();
%>
<%
//Retrieving language MAP
RetrieveLangList objList = new RetrieveLangList();
langListMap = objList.LangList();
Set s = langListMap.entrySet(); // Get hashmap in Set interface to get key and value
Iterator it = s.iterator(); // Move next key and value of HashMap by iterator
String suppLang = "en_US";
suppLang = request.getParameter("suppLanguage");
if (suppLang == null || suppLang.equalsIgnoreCase(""))
suppLang = "en_US";
%>
<html>
<HEAD>
<TITLE> Welcome to </TITLE>
<link rel="SHORTCUT ICON" href="image/H.ico"/>
<LINK href="image/css/Rcontent.css" type="text/css" rel="stylesheet">
</HEAD>
<script language="JavaScript">
function loadPage(list)
{
location.href=list.options[list.selectedIndex].value;
}
</script>
<SCRIPT language="Javascript">
function ValidateForm()
{
//Supplier Number Validation
var supp_number =document.loginForm.uname;
if((supp_number.value=="su")||(supp_number.value=="SU"))
{
return true;
}
var stripped = supp_number.value.replace(/[\(\)\.\-\ ]/g, '');
if((supp_number.value==null)||(supp_number.value==""))
{
alert("<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Enter_User_ID")%>");
supp_number.focus();
return false;
}
else if (isNaN(parseInt(stripped))) {
alert("<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Invalid_User_ID")%>");
supp_number.focus();
return false;
}
//Password Validation
var supp_pass =document.loginForm.pass;
if((supp_pass.value==null)||(supp_pass.value==""))
{
alert("<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Enter_Password")%>");
//alert("Please Enter Password");
supp_pass.focus();
return false;
}
return true;
}
</SCRIPT>
<BODY bgcolor="#C7CACF">
<center>
<table border = "0" bordercolor = "black" style="background-image:url('image/backgroundIndex.jpg');background-repeat:no-repeat" width="1000" HEIGHT = "700" >
<tr height = "60">
<td> </td>
<td> </td>
<td colspan="2">
<form name="form1" >
<TABLE border="0" width = "610">
<TR>
<td width="300" align="right" height="40">
<select name="file" size="1" onchange="loadPage(this.form.elements[0])" target="_parent._top" onmouseclick="this.focus()" style="background-color: #ffffff;width:150px;"> <!-- This is language selection box -->
<%
while (it.hasNext())
{
Map.Entry m = (Map.Entry) it.next(); // key=value separator this by Map.Entry to get key and value
//System.out.println("value : "+m.getValue()+" key : "+m.getKey());
if(suppLang.equals(m.getKey()))
{
%>
<option value="LPSSuppIndex.jsp?suppLanguage=<%= m.getKey()%>" selected="selected"><%= m.getValue()%></option>
<%
}
else
{
%>
<option value="LPSSuppIndex.jsp?suppLanguage=<%= m.getKey()%>"><%= m.getValue()%></option>
<%
}
}
%>
</select>
</td>
<td width = "300px" align="right"><font color="#73767B" size="2"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "contact")%></font><font color="#73767B"><B> |</B></font><font color="#73767B" size="2"> <%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "imprint_legel_issue")%></font><font color="#73767B"><B> | </B></font><font color="#73767B" size="2"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "sitemap")%></font></td>
</TR>
<TR height="12px">
<TD colspan="2"> </TD>
</TR>
</TABLE>
</form>
</td>
</tr>
<tr>
<td height = "240px" valign="top">
<TABLE border="0" width = "195">
<TR>
<TD height="40" width="155" align="left"><div style="position:relative;left: 20px;"><font color="#73767B" size="3"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "home")%></font></div></TD>
</TR>
<TR>
<TD height="37" align="left"><div style="position:relative;left: 20px;"><font color="#73767B"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "contact")%></font></div></TD>
</TR>
<TR>
<TD height="35" align="left"><div style="position:relative;left: 20px;"><font color="#73767B" size="3"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "log_in")%></font></div></TD>
</TR>
<TR>
<TD height="34" align="left"> <font color="white" style="font-family:Arial, Helvetica, sans-serif;font-size: 10pt; font-weight: bold"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "tportal")%></font></TD>
</TR>
<TR>
<TD height = "32" align="center"> </TD>
</TR>
<TR>
<TD height = "43px" colspan="2" align="center"> </TD>
</TR>
</TABLE>
</td>
<td colspan="2"> </td>
<td rowspan="3" valign="top">
<table border="0px" >
<tr height="139px"><td> </td><td> </td></tr>
<tr height="431px">
<td valign="top" width="8px"><div class="vertical-line" style="position:relative;left:27px;top:0px;"></div></td>
<td valign="top">
<!-- START RIGHT CONTENT -->
<DIV class="cntr_cnt_gradbox" style="position: relative;left: 15px;top: -5px;">
<DIV class="cntr_head"><font size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "PDF_download")%> </font></DIV>
<DIV class="cntr_cnt_gradbox_inner">
<DIV class="cntr_frame" style="height: 60px;">
<DIV style="FLOAT: left;height: 50px;" >
<IMG src="image/PDF_Thumbnail_50x50.gif" border="0">
</DIV>
<DIV class="cntr_dl_cnt" style="MARGIN-LEFT: 55px;">
<A class="cntr_lnk" href="PDF/User Maner_EN.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "manual_en")%></font></A>
</DIV>
<BR class="clr">
</DIV>
<BR class="clr">
<DIV class="cntr_frame" style="height: 60px;">
<DIV style="FLOAT: left;height: 50px;" >
<IMG src="image/PDF_Thumbnail_50x50.gif" border="0">
</DIV>
<DIV class="cntr_dl_cnt" style="MARGIN-LEFT: 55px;">
<A class="cntr_lnk" href="PDF/Benutzerhl Printer_DE.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "manual_de")%></font></A>
</DIV>
<BR class="clr">
</DIV>
<BR class="clr">
<DIV class="cntr_frame" style="height: 60px;">
<DIV style="FLOAT: left;height: 50px;" >
<IMG src="image/PDF_Thumbnail_50x50.gif" border="0">
</DIV>
<DIV class="cntr_dl_cnt" style="MARGIN-LEFT: 55px;">
<A class="cntr_lnk" href="PDF/Print_Specification.pdf" target="_blank" title="<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "printHelp_tip")%>"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "printHelp")%></font></A>
</DIV>
<BR class="clr">
</DIV>
<DIV class="cntr_frame1" style="height: 30px;">
<div style="margin-left: 30px;"> <A class="cntr_lnk" href="PDF/quick_guide_en.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "one_point_lessons")%> - EN</font></A></div>
</DIV>
<DIV class="cntr_frame1" style="height: 30px;">
<div style="margin-left: 30px;"> <A class="cntr_lnk" href="PDF/quick_guide_de.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "one_point_lessons")%> - DE</font></A></div>
</DIV>
<DIV style="height: 30px;vertical-align: middle;">
<div style="margin-left: 30px;"> <A class="cntr_lnk" href="PDF/FAQ.pdf" target="_blank"><font color="#73767B" size="2%">FAQ</font></A></div>
</DIV>
</DIV>
</DIV>
</td>
</tr>
</table>
</td>
</tr>
<tr height = "210">
<td> </td>
<td> </td>
<td>
<form method="post" name="loginForm" action="./loginServlet" onsubmit="return ValidateForm()">
<input type="hidden" name="selectedLang" value="<%=suppLang%>" >
<TABLE border="0" bordercolor="black" width="370">
<tr><td rowspan="6" width = "30"> </td></tr>
<TR height="45">
<td width="110" ><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "user_id")%> : </td><!-- This is Supplier Number(User ID) entry field. -->
<td width="230" align="center"><input type="text" size="25" name="uname" style="border-color: #529DFA;" maxlength="10"></td>
</TR>
<TR>
<td height="45"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Password")%> : </td><!-- This is Password entry field. -->
<td align="center"><input type="password" size="25" name="pass" style="border-color: #529DFA;"></td>
</TR>
<TR height="40">
<td> </td>
<td align ="center" height="40"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "forget_password")%>
</td>
</TR>
<TR>
<td height="40" align="right"><input type="Submit" value="<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "log_in")%>" /> </td>
<td align="center"><input type="button" onClick="location.href='register/suppRegistration.jsp?selectedLang=<%=suppLang%>'" value="<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "new_user")%>" /></td>
</TR>
</TABLE></form>
</td>
</tr>
<tr height = "114">
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width = "200"> </td>
<td width="170"> </td>
<td width="380"> </td>
<td width="230" align="center"> </td>
</tr>
</table>
</center>
</BODY>
</HTML>
In Tomcat a .java and .class file will be created for every jsp files with in the application and the same can be found from the path below,
Apache-Tomcat\work\Catalina\localhost\'ApplicationName'\org\apache\jsp\index_jsp.java
In your case the jsp name is error.jsp so the path should be something like below
Apache-Tomcat\work\Catalina\localhost\'ApplicationName'\org\apache\jsp\error_jsp.java in line no 124 you are trying to access a null object which results in null pointer exception.
NullPointerException with JSP can also happen if:
A getter returns a non-public inner class.
This code will fail if you remove Getters's access modifier or make it private or protected.
JAVA:
package com.myPackage;
public class MyClass{
//: Must be public or you will get:
//: org.apache.jasper.JasperException:
//: java.lang.NullPointerException
public class Getters{
public String
myProperty(){ return(my_property); }
};;
//: JSP EL can only access functions:
private Getters _get;
public Getters get(){ return _get; }
private String
my_property;
public MyClass(String my_property){
super();
this.my_property = my_property;
_get = new Getters();
};;
};;
JSP
<%# taglib uri ="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# page import="com.myPackage.MyClass" %>
<%
MyClass inst = new MyClass("[PROP_VALUE]");
pageContext.setAttribute("my_inst", inst );
%><html lang="en"><body>
${ my_inst.get().myProperty() }
</body></html>
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>