• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Can't get c:import to work

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried to use <c:import> with some jsp files but it doesn't work correctly. I have been reading the book "Core JavaServer Faces" from Sun which has not helped me. Any guidance would be appreciated.

I'm using IBM RAD 6.0.1 for development and testing if that matters.

Thanks,
Jeff


I am including the code for evaluation:


TestLayout.jsp:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<%-- jsf agecode language="java" location="/JavaSource/pagecode/quotes/property/app_common/TestLayout.java" --%><%-- /jsf agecode --%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<!--%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %-->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="GENERATOR" content="IBM Software Development Platform" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="../../../theme/Master.css" rel="stylesheet" type="text/css" />
<title>TestLayout.jsp</title>
<link rel="stylesheet" type="text/css"
href="../../../theme/stylesheet.css" title="Style" />
</head>
<f:view>
<body>
<h:form>
<f:subview id="insuredSubview">
<jsp:include page="Insured.jsp" />
</f:subview>
<f:subview id="propertyDescSubview">
<c:import url="PropertyDesc.jsp" />
</f:subview>
</h:form>
</body>
</f:view>
</html>





Insured.jsp

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<table>
<tbody>
<tr>
<td>
<fieldset><legend>Applicant</legend>
<table>
<tbody>
<tr>
<td>Name</td>
<td colspan="5">
<h:inputText styleClass="inputText" id="txtAppName"
size="50"></h:inputText>
<input type="text" size="50"></input>
</td>
</tr>
<tr>
<td>Address</td>
<td colspan="5">
<h:inputText styleClass="inputText" id="txtAppAddress" size="50"></h:inputText>
</td>
</tr>
<tr>
<td>City</td>
<td>
<h:inputText styleClass="inputText" id="txtAppCity"></h:inputText>
</td>
<td>State</td>
<td>
<h:inputText styleClass="inputText" id="txtAppState" size="3"></h:inputText>
</td>
<td>Zip</td>
<td>
<h:inputText styleClass="inputText" id="txtAppZip"></h:inputText>
</td>
</tr>
<tr>
<td>Insured SSN</td>
<td colspan="2">
<h:inputText styleClass="inputText" id="txtAppInsuredSSN"></h:inputText>
</td>
<td>Spouse SSN</td>
<td colspan="2">
<h:inputText styleClass="inputText" id="txtAppInsuredSpouseSSN"></h:inputText>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
<td>
<fieldset><legend>Mortgagee</legend>
<table>
<tbody>
<tr>
<td>Name</td>
<td colspan="5">
<h:inputText styleClass="inputText" id="txtMortName" size="50"></h:inputText>
</td>
</tr>
<tr>
<td>Address</td>
<td colspan="5">
<h:inputText styleClass="inputText" id="txtMortAddress" size="50"></h:inputText>
</td>
</tr>
<tr>
<td>City</td>
<td>
<h:inputText styleClass="inputText" id="txtMortCity"></h:inputText>
</td>
<td>State</td>
<td>
<h:inputText styleClass="inputText" id="txtMortState" size="3"></h:inputText>
</td>
<td>Zip</td>
<td>
<h:inputText styleClass="inputText" id="txtMortZip"></h:inputText>
</td>
</tr>
<tr>
<td>Loan Number</td>
<td colspan="5">
<h:inputText styleClass="inputText" id="txtMortLoanNumber"></h:inputText>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
</tr>
<tr>
<td colspan="2">
<fieldset><legend>Date of Birth</legend>
<table>
<tbody style="text-align: center">
<tr>
<td>Insured</td>
<td><h:inputText styleClass="inputText" id="txtInsuredDOB"></h:inputText>
<td>Spouse</td>
<td><h:inputText styleClass="inputText" id="txtSpouseDOB"></h:inputText>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
</tr>
</tbody>
</table>
</body>




PropertyDesc.jsp

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<table>
<tbody>
<tr>
<td># Acres</td>
<td>
<h:inputText styleClass="inputText" id="txtAcres"></h:inputText>
</td>
<td>Quarter</td>
<td>
<h:inputText styleClass="inputText" id="txtQuarter"></h:inputText>
</td>
<td>Section</td>
<td>
<h:inputText styleClass="inputText" id="txtSection"></h:inputText>
</td>
<td>Township</td>
<td>
<h:inputText styleClass="inputText" id="txtTownship"></h:inputText>
</td>
<td>Range</td>
<td>
<h:inputText styleClass="inputText" id="txtRange"></h:inputText>
</td>
<td>County</td>
<td>
<h:inputText styleClass="inputText" id="txtCounty"></h:inputText>
</td>
</tr>
<tr>
<td>City Code</td>
<td colspan="2">
<h:inputText styleClass="inputText" id="txtCityCode"></h:inputText>
</td>
<td>County Code</td>
<td colspan="2">
<h:inputText styleClass="inputText" id="txtCountyCode"></h:inputText>
</td>
<td>Other OFU Policy Numbers</td>
<td colspan="2">
<h:inputText styleClass="inputText" id="txtOtherPolicyNums"></h:inputText>
</td>
</tr>
</tbody>
</table>





What got rendered: TestLayout-broke.html

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">




<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<!--%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %-->

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="GENERATOR" content="IBM Software Development Platform" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="../../../theme/Master.css" rel="stylesheet" type="text/css" />
<title>TestLayout.jsp</title>
<link rel="stylesheet" type="text/css"
href="../../../theme/stylesheet.css" title="Style" />
</head>

<body>
<form id="_id0" method="post" action="/quote/faces/quotes/property/app_common/TestLayout.jsp" enctype="application/x-www-form-urlencoded">


<input id="_id0:insuredSubview:txtAppName" type="text" name="_id0:insuredSubview:txtAppName" class="inputText" size="50" /><input id="_id0:insuredSubview:txtAppAddress" type="text" name="_id0:insuredSubview:txtAppAddress" class="inputText" size="50" /><input id="_id0:insuredSubview:txtAppCity" type="text" name="_id0:insuredSubview:txtAppCity" class="inputText" /><input id="_id0:insuredSubview:txtAppState" type="text" name="_id0:insuredSubview:txtAppState" class="inputText" size="3" /><input id="_id0:insuredSubview:txtAppZip" type="text" name="_id0:insuredSubview:txtAppZip" class="inputText" /><input id="_id0:insuredSubview:txtAppInsuredSSN" type="text" name="_id0:insuredSubview:txtAppInsuredSSN" class="inputText" /><input id="_id0:insuredSubview:txtAppInsuredSpouseSSN" type="text" name="_id0:insuredSubview:txtAppInsuredSpouseSSN" class="inputText" /><input id="_id0:insuredSubview:txtMortName" type="text" name="_id0:insuredSubview:txtMortName" class="inputText" size="50" /><input id="_id0:insuredSubview:txtMortAddress" type="text" name="_id0:insuredSubview:txtMortAddress" class="inputText" size="50" /><input id="_id0:insuredSubview:txtMortCity" type="text" name="_id0:insuredSubview:txtMortCity" class="inputText" /><input id="_id0:insuredSubview:txtMortState" type="text" name="_id0:insuredSubview:txtMortState" class="inputText" size="3" /><input id="_id0:insuredSubview:txtMortZip" type="text" name="_id0:insuredSubview:txtMortZip" class="inputText" /><input id="_id0:insuredSubview:txtMortLoanNumber" type="text" name="_id0:insuredSubview:txtMortLoanNumber" class="inputText" /><input id="_id0:insuredSubview:txtInsuredDOB" type="text" name="_id0:insuredSubview:txtInsuredDOB" class="inputText" /><input id="_id0:insuredSubview:txtSpouseDOB" type="text" name="_id0:insuredSubview:txtSpouseDOB" class="inputText" />

<table>
<tbody>
<tr>
<td>
<fieldset><legend>Applicant</legend>
<table>
<tbody>
<tr>
<td>Name</td>
<td colspan="5">

<input type="text" size="50"></input>
</td>
</tr>
<tr>
<td>Address</td>
<td colspan="5">

</td>
</tr>
<tr>
<td>City</td>
<td>

</td>
<td>State</td>
<td>

</td>
<td>Zip</td>
<td>

</td>
</tr>
<tr>
<td>Insured SSN</td>
<td colspan="2">

</td>
<td>Spouse SSN</td>
<td colspan="2">

</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
<td>
<fieldset><legend>Mortgagee</legend>
<table>
<tbody>
<tr>
<td>Name</td>
<td colspan="5">

</td>
</tr>
<tr>
<td>Address</td>
<td colspan="5">

</td>
</tr>
<tr>
<td>City</td>
<td>

</td>
<td>State</td>
<td>

</td>
<td>Zip</td>
<td>

</td>
</tr>
<tr>
<td>Loan Number</td>
<td colspan="5">

</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
</tr>
<tr>
<td colspan="2">
<fieldset><legend>Date of Birth</legend>
<table>
<tbody style="text-align: center">
<tr>
<td>Insured</td>
<td>
<td>Spouse</td>
<td>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
</tr>
</tbody>
</table>
</body>



<c:import url="PropertyDesc.jsp" />

<input type="hidden" name="_id0" value="_id0" /></form>
</body>

</html>

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use jsp:include and see if that works any better.
 
Jeff Bowman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the jsp:include without any success. I'm wondering if this is related to the form. Basically, I have two applications which have identical parts in places. I'd like to code up the identical parts as included/imported files, but they will each contain form elements. So the watered down structure will look like this:



I'm wondering if the issue is the h:form since non-form elements seem to be rendered correctly?

Regards,
Jeff
 
reply
    Bookmark Topic Watch Topic
  • New Topic