JSF Exception - 404 500 codes - exception

I have a JSF2 application which uses primefaces 3.0.
When I include 404 error code or 500 error code in my web.xml
<error-page>
<error-code>404</error-code>
<location>/faces/404.xhtml</location>
</error-page>
I get the following exception.
java.lang.NullPointerException
at com.sun.faces.context.flash.ELFlash.doLastPhaseActions(ELFlash.java:607)
at com.sun.faces.context.ExternalContextImpl.responseFlushBuffer(ExternalContextImpl.java:857)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:155)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
How to suppress this exception? Am I missing something on my exception handling?
Here is the 404.xhmtl. I am not using any reference bean in 404 xhtml.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
id="htmlPage">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body id="body">
<center>
<div class="headerTop">
<table id="pageHeader">
<tr>
<td align="left">
Header
</td>
</tr>
</table>
</div>
<table id="pageContent" style="background-color: white;min-width: 60%;max-width: 90%" >
<tr>
<td align="center" valign="top" style="min-height: 600px;">
<table width="100%" style="float: left">
<tr>
<td>
404 Error
</td>
</tr>
</table>
</td>
</tr>
</table>
<table style=" width:100%;">
<tr>
<td align="center">
<div>
footer
</div>
</td>
</tr>
</table>
</center>
</h:body>
</html>

Related

Selenium IDE - selectFrame issues

Im new to Selenium IDE on Firefox and having iFrame issues. When Selenium runs "selectframe" I get an error iframe not found. Im not familiar with xpath or webdriver so I wouldn't know how to fix it using that. I've attached a screenshot of the iFrame. I also can't find the name of the iFrame.
Error message is : "[error] Element recurlyHostedField:number not found"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://www.test.com/" />
<title>LCPayment</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">LCPayment</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/all-access/subscription/payment/</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=AA_LC_TRIAL_MONTHLY</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=first_name</td>
<td>test</td>
</tr>
<tr>
<td>type</td>
<td>id=last_name</td>
<td>testing</td>
</tr>
<tr>
<td>type</td>
<td>id=address1</td>
<td>5643 street</td>
</tr>
<tr>
<td>type</td>
<td>id=city</td>
<td>los angeles</td>
</tr>
<tr>
<td>select</td>
<td>id=state</td>
<td>label=CO</td>
</tr>
<tr>
<td>type</td>
<td>id=postal_code</td>
<td>90023</td>
</tr>
<tr> \\this is where the error happens. when I run selectFrame an error appears "[error] Element recurlyHostedField:number not found"
<td>selectFrame</td>
**<td>recurlyHostedField:number</td>**
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=recurly-hosted-field-input</td>
<td>4111 1111 1111 1111</td>
</tr>
</tbody></table>
</body>
</html>
enter image description here

center logo in table foundation framework

I recently started using the foundation framework with email newsletters. As I can see I have to go back to the good old tables. I cannot understand why I have so big problems of centering/align a logo?
The logo is keep hanging to the left, instead of center. I have set a border on the tables so it is eaiser to see.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>A title</title>
<link rel="stylesheet" href="css/foundation-emails.css" />
<style type="text/css">
</style>
</head>
<body>
<!-- <style> -->
<table class="body" data-made-with-foundation>
<tr>
<td class="float-center" align="center" valign="top" style="border: 1px solid pink">
<center>
<table class="container" align="center" style="border: 1px solid green">
<tbody>
<tr>
<td>
<table class="row">
<tbody>
<tr>
<th class="small-12 large-12 columns first">
<table>
<tr>
<th>
<img src="https://i1.wp.com/1stwebdesigner.com/wp-content/uploads/2016/04/line-art-logo.jpg?fit=600%2C400&resize=350%2C200" style="border:1px solid red" align="center">
</th>
<th class="expander"></th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</table>
</body>
</html>
Finally after 2 hours searcing I found the answer here:
https://foundation.zurb.com/emails/docs/alignment.html
First of all, your document (!DOCTYPE) IS NOT XHTML. You need to use transitional or HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
or
<!DOCTYPE html>
After that, you need:
<img src="https://i1.wp.com/1stwebdesigner.com/wp-content/uploads/2016/04/line-art-logo.jpg?fit=600%2C400&resize=350%2C200" style="border:1px solid red; margin: 0 auto;">
align="center" is NOT a valid HTML5 property, it is valid in HTML4+

Radio buttons in a gridview

In this table, when I check the radio button (present) on the 1st row and when I go and check again the present on the 2nd row, the first row present in getting unchecked automatically. And all the radiobutton gets checked. This is just a sample for two students.
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>HTML Tables</title>
</head>
<body>
<%# page import="java.sql.*"%>
<table bgcolor="lightgray" border="5" width="60%" cellpadding="5" cellspacing="0.5" color="blue" >
<tr>
<th colspan ="3" bgcolor="#999999"><br>
<div align="Center" > <font face="verdana" size="5" color="white"> ATTENDANCE </font>
</div>
</th>
</tr>
<tr>
<td width="14%"><h3>Register No</td>
<td><h3> Student Name</td>
<td><h3> Attendance</td>
</tr>
<tr>
<td> 1 </td>
<td> <input type="radio" >Present <input type="radio">Absent
<tr>
<td>2</td>
<td> <input type="radio" >Present <input type="radio">Absent
</tr>
<%
Connection dbcon=null;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
dbcon=DriverManager.getConnection("jdbc:oracle:thin:#localhost:1521:orcl","scott","tiger");
Statement stmt=dbcon.createStatement();
ResultSet rst=null;
rst=stmt.executeQuery("select * from studenttables");
while(rst.next())
{%>
<tr>
<td><%=rst.getString("name")%></td>
</tr>
<tr>
<td><%=rst.getString("name")%></td>
</tr>
<tr>
<td><%=1%></td>
<td><%=rst.getString("name")%></td>
<td><input type="radio" >Present <input type="radio">Absent
</tr>
<% } %>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
Set a name and make a group of radio buttons like
() - name="rdg1" and id="Present"
() - name="rdg1" and id="Absent"
and
() - name="rdg2" and id="Present2"
() - name="rdg2" and id="Absent2"
if the rdg1 - Present is checked and you click to check the rdg1 - Absent the check box 1 will clear, same to second group.

HTML tables border not disapearing when set to 0

The problem that I am having is while designing an email to be sent to users the border of the HTML table is not disappearing even though it is set to 0 and so leaves horrible white lines through areas which are menu to be solid blue colors, below is my HTML code!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="889" border="0" >
<tr>
<td>
<table width="882" border="0" bordercolor="#0099FF">
<tr>
<td colspan="4" bgcolor="#0099FF"> </td>
</tr>
<tr bgcolor="#0099FF">
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td bgcolor="#0099FF"> </td>
<td colspan="2" rowspan="2">content</td>
<td bgcolor="#0099FF"> </td>
</tr>
<tr bgcolor="#CCCCCC">
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Add cellspacing="0" to your second table:
<table width="882" border="0" bordercolor="#0099FF" cellspacing="0">
Probably cellspacing="0" fixes these lines?

Telerik Radwindow collapses when overflow is hidden for IE 9

I have a simple page that pops up a telerik radwindow on button click.
But opens as collapsed in IE 9. Works fine with FF, Chrome, IE 8, IE Compatibility Mode.
Look at the below screenshots of how they open.
IE 9
Firefox
Heres the page code.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%# Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="scriptManager" runat="server" />
<telerik:RadButton ID="btnOpen" runat="server" Text="Open" OnClick="btnOpen_Click" />
<br />
<telerik:RadWindow ID="TestDialog" runat="server" Title="Select Order Services"
VisibleStatusbar="false" AutoSize="true" AutoSizeBehaviors="Height" Width="400px"
Modal="true" VisibleOnPageLoad="false" Behaviors="Close, Move" EnableShadow="true">
<ContentTemplate>
<div style="overflow: hidden;">
<table cellspacing="0" border="0"
style="table-layout: auto; ">
<tbody>
<tr>
<th style="width: 100px;">Column 1</th>
<th style="width: 100px;">Column 2</th>
</tr>
<tr>
<td>
a
</td>
<td>
a
</td>
</tr>
<tr>
<td>
b
</td>
<td>
b
</td>
</tr>
<tr>
<td>
c
</td>
<td>
c
</td>
</tr>
</tbody>
</table>
</div>
</ContentTemplate>
</telerik:RadWindow>
</form>
</body>
</html>
Code behind:
protected void btnOpen_Click(object sender, EventArgs e)
{
TestDialog.VisibleOnPageLoad = true;
}
I want the overflow:hidden present in the style and still want the pop up opened fully in IE 9. How do I get it?
Found a way.
<ContentTemplate>
<div style="display: inline; overflow: hidden;">
...
This is a solution, but I dont really understand how this works! That was one lucky line of code I wrote!
If any one can explain me why it works, I will mark theirs as answer.