passing the selected checkbox values to the Database in Struts2 - java

I'm using Struts2 and This is my form in JSP
<s:form target="_top" cssClass="table-controls form-wrapper" name="incentives" id="frmIncentives" action="saveIncentives.action" method="post">
<div id="actionErrors" style="color: red;">
<s:actionerror />
<s:fielderror />
</div>
<table id ="showIncentives" cellspacing="0" cellpadding="0" border="1" width="500" >
<tr style="font-weight: bold">
<td><s:checkbox name="Select All" id="select_all"
theme="simple" /></td>
<td>
<td></td>
<td></td>
<td><s:text name="Marketing Incentive" /></td>
<td></td>
<td><s:text name="Advertising Incentive" /></td>
<td></td>
<td><s:text name="Channel Placement Incentive" /></td>
<td></td>
</tr>
<s:iterator value="incentiveList" status="stat">
<tr>
<td><s:checkbox name="checkboxes[%{#stat.index}]" theme="simple" /></td>
<td></td>
<td><s:property value="pricingTierId" /> <s:hidden value="%{incentiveList.pricingTierId}" /></td>
<td><s:property value="marketingAmount" /> <s:hidden value="%{incentiveList.marketingAmount}" /></td>
<td></td>
<td><s:property value="marketingIncentive" /></td>
<td></td>
<td><s:property value="advertizingIncentive" /></td>
<td></td>
<td><s:property value="channelPlacementIncentive" /></td>
<td></td>
</tr>
</s:iterator>
</table>
<c:if test="${fn:length(incentiveList) == 0}">
<s:submit id="submitButton" name="submit" value="Submit Incentives" onclick='return closeWindow()' disabled="true"/>
</c:if>
<c:if test="${fn:length(incentiveList) gt 0}">
<s:submit id="submitButton" name="submit" value="Submit Incentives" onclick='return closeWindow()' disabled="false"/>
</c:if>
</s:form>
And now method in my Action class is as below
private String marketingIncentive;
private String advertizingIncentive;
private String channelPlacementIncentive;
private BigDecimal marketingAmount;
private Integer pricingTierId;
//getters and setters
public String getMarketingIncentive() {
return marketingIncentive;
}
public void setMarketingIncentive(String marketingIncentive) {
this.marketingIncentive = marketingIncentive;
}
public String getAdvertizingIncentive() {
return advertizingIncentive;
}
public void setAdvertizingIncentive(String advertizingIncentive) {
this.advertizingIncentive = advertizingIncentive;
}
public String getChannelPlacementIncentive() {
return channelPlacementIncentive;
}
public void setChannelPlacementIncentive(String channelPlacementIncentive) {
this.channelPlacementIncentive = channelPlacementIncentive;
}
public BigDecimal getMarketingAmount() {
return marketingAmount;
}
public void setMarketingAmount(BigDecimal marketingAmount) {
this.marketingAmount = marketingAmount;
}
// Method to save the selected checkbox values
public String saveIncentives(){
WorkFlowDAO workFlowDAO = new WorkFlowDAO();
try {
if(submit != null){
IncentiveDetailsDO incentiveDetailsDO = new IncentiveDetailsDO();
incentiveDetailsDO.setPricingTierId(pricingTierId);
incentiveDetailsDO.setMarketingAmount(marketingAmount);
incentiveDetailsDO.setMarketingIncentive(marketingIncentive);
incentiveDetailsDO.setAdvertizingIncentive(advertizingIncentive);
incentiveDetailsDO.setChannelPlacementIncentive(channelPlacementIncentive);
workFlowDAO.applyIncentives(incentiveDetailsDO);
closeWindow = true;
}
} catch (Exception e) {
e.printStackTrace();
}
return SUCCESS;
}
The
pricingTierId , marketingIncentive, advertizingIncentive ,
channelPlacementIncentive and channelPlacementIncentive
are passed to the function as null in spite of having getters and setters in the Action class .
I have made the changes as suggested below
<s:iterator value="incentiveList" status="stat">
<tr>
<td><s:checkbox name="checkboxes[%{#stat.index}]" theme="simple" /></td>
<td></td>
<td><s:property value="pricingTierId" /> <s:hidden name="pricingTierId" value="%{incentiveList.pricingTierId}" /></td>
<td><s:property value="marketingAmount" /> <s:hidden name="marketingAmount" value="%{incentiveList.marketingAmount}" /></td>
<td></td>
<td><s:property value="marketingIncentive" />
<s:hidden name="marketingIncentive" value="%{incentiveList.pricingTierId}" />
</td>
<td></td>
<td><s:property value="advertizingIncentive"/>
<s:hidden name="advertizingIncentive" value="%{incentiveList.pricingTierId}"/>
</td>
<td><s:property value="channelPlacementIncentive" />
<s:hidden name="channelPlacementIncentive" value="%{incentiveList.pricingTierId}" />
</td>
<td></td>
</tr>
</s:iterator>
Still all the values are being passed as null .
Please suggest

Your form will be look like this .
<s:form target="_top" cssClass="table-controls form-wrapper" name="incentives" id="frmIncentives" action="saveIncentives.action" method="post">
<div id="actionErrors" style="color: red;">
<s:actionerror />
<s:fielderror />
</div>
<table id ="showIncentives" cellspacing="0" cellpadding="0" border="1" width="500" >
<tr style="font-weight: bold">
<td><s:checkbox name="Select All" id="select_all"
theme="simple" /></td>
<td>
<td></td>
<td></td>
<td><s:text name="Marketing Incentive" /></td>
<td></td>
<td><s:text name="Advertising Incentive" /></td>
<td></td>
<td><s:text name="Channel Placement Incentive" /></td>
<td></td>
</tr>
<s:iterator value="incentiveList" status="stat">
<tr>
<td><s:checkbox name="checkboxes[%{#stat.index}]" theme="simple" /></td>
<td></td>
<td><s:property value="pricingTierId" /> <s:hidden name="pricingTierId" value="%{incentiveList.pricingTierId}" /></td>
<td><s:property value="marketingAmount" /> <s:hidden name="marketingAmount" value="%{incentiveList.marketingAmount}" /></td>
<td></td>
<td><s:property value="marketingIncentive" /><s:hidden name="marketingIncentive" value="%{incentiveList.marketingIncentive}" /></td>
<td></td>
<td><s:property value="advertizingIncentive" /><s:hidden name="advertizingIncentive" value="%{incentiveList.advertizingIncentive}" /></td>
<td></td>
<td><s:property value="channelPlacementIncentive" /><s:hidden name="channelPlacementIncentive" value="%{incentiveList.channelPlacementIncentive}" /></td>
<td></td>
</tr>
</s:iterator>
</table>
<c:if test="${fn:length(incentiveList) == 0}">
<s:submit id="submitButton" name="submit" value="Submit Incentives" onclick='return closeWindow()' disabled="true"/>
</c:if>
<c:if test="${fn:length(incentiveList) gt 0}">
<s:submit id="submitButton" name="submit" value="Submit Incentives" onclick='return closeWindow()' disabled="false"/>
</c:if>
</s:form>

Related

Trying to open a edit form to edit an object in Spring but returning a 404

I'm trying to create an edit form and prepopulate to form with the chosen objects values but it is returning an HTTP status of 404 and the error message I'm getting is
org.springframework.web.servlet.DispatcherServlet.noHandlerFound No
mapping for GET
/AgentsCRUD/agent/edit/1;jsessionid=07E2EC08848D0C9C9346DC67563DDF1F
I think what I have is pretty logical but I must have messed up with the mapping.
The code in the get AllAgent.jsp
<spring:message code="welcome.message" />
<body>
<table style="width:100%">
<tr>
<th align="left"><spring:message code="label.agentId" /></th>
<th align="left"><spring:message code="label.name" /></th>
<th align="left"><spring:message code="label.fax" /></th>
<th align="left"><spring:message code="label.phone" /></th>
<th align="left"><spring:message code="label.email" /></th>
<th align="left"><spring:message code="label.datejoined" /></th>
<th align="left"><spring:message code="label.sales" /></th>
<th align="left"><spring:message code="label.actions" /></th>
</tr>
<c:forEach items="${agentList}" var="agent">
<tr>
<td>${agent.agentId}</td>
<td>${agent.name}</td>
<td>${agent.fax}</td>
<td>${agent.phone}</td>
<td>${agent.email}</td>
<td>
<spring:message code="label.delete" />
<spring:url value="/agent/edit/${agent.agentId}" var="editURL"/>
<spring:message code="label.edit" />
<spring:message code="label.insert" />
</td>
</tr>
</c:forEach>
</table>
</body>
the code in the controller AgentController.java
#GetMapping("/edit")
public ModelAndView EditAnAgent(#QueryParam("agentId") int agentId) {
return new ModelAndView("/editAgent", "agent", service.getAgentById(agentId));
}
#GetMapping("/editAgent")
public ModelAndView editAgent(#Valid #ModelAttribute("agent") Agents a, BindingResult result, ModelMap model) {
if (result.hasErrors()) {
return new ModelAndView("/editAgent");
}
service.editAgent(a);
return new ModelAndView("redirect:/agent");
}
the code in the Model AgentService.java
public static Agents getAgentByID(int agentId) {
EntityManager em = DBUtil.getEMF().createEntityManager();
Agents a = null;
try {
a = em.createNamedQuery("Agents.findByAgentId", Agents.class)
.setParameter("agentId", (agentId))
.getSingleResult();
} catch (Exception ex) {
System.out.println("Error in getting property details: " + ex);
} finally {
em.clear();
}
return a;
}
public void editAgent(Agents a) {
EntityManager em = DBUtil.getEMF().createEntityManager();
EntityTransaction transaction = em.getTransaction();
try {
transaction.begin();
em.merge(a);
transaction.commit();
} catch (Exception e) {
System.out.println(e);
} finally {
em.close();
}
}
the code in the editAgent.jsp
<form:form method="POST" action="/AgentsCRUD/agent/editAgent" modelAttribute="agent">
<table>
<tr>
<td><form:label path="agentId"><spring:message code="label.agentId" /></form:label></td>
<td><form:input path="agentId"/></td>
<td style="color:red"><form:errors path="agentId"/> </td>
</tr>
<tr>
<td><form:label path="name"><spring:message code="label.name" /></form:label></td>
<td><form:input path="name" /></td>
<td style="color:red"><form:errors path="name"/> </td>
</tr>
<tr>
<td><form:label path="phone"><spring:message code="label.phone" /></form:label></td>
<td><form:input path="phone"/></td>
<td style="color:red"><form:errors path="phone"/> </td>
</tr>
<tr>
<td><form:label path="fax"><spring:message code="label.fax" /></form:label></td>
<td><form:input path="fax"/></td>
<td style="color:red"> <form:errors path="fax"/> </td>
</tr>
<tr>
<td><form:label path="email"><spring:message code="label.email" /></form:label></td>
<td><form:input path="email"/></td>
<td style="color:red"> <form:errors path="email"/> </td>
</tr>
<tr>
<td><form:label path="username"><spring:message code="label.username" /></form:label></td>
<td><form:input path="username"/></td>
<td style="color:red"> <form:errors path="username"/> </td>
</tr>
<tr>
<td><form:label path="password"><spring:message code="label.password" /></form:label></td>
<td><form:input path="password"/></td>
<td style="color:red"> <form:errors path="password"/> </td>
</tr>
<tr>
<spring:message code="submit.button" var="labelSubmit"></spring:message>
<td><input type="submit" value="${labelSubmit}"/></td>
</tr>
</table>
</body>
</form:form>
In the Error the url given is .../edit/1 where 1 is a path parameter,
However in the get mapping, you are trying to read it as a query parameter.
Try this.
#GetMapping("/edit/{agentId}")
Patient getEmployee(#PathParam("agentId") int agentId) ;

how to display "Model object Attribute ArrayList<String>" values as DROP DOWN values in JSP

<form:form action="saveNewUsers" method="post" modelAttribute="users">
<table>
<tr><td>Id</td>
<td><form:input path="id"/></td>
</tr>
<tr>
<td>User</td>
<td><form:input path="user" /></td>
</tr>
<tr>
<td>Password</td>
<td><form:input path="password" /></td>
</tr>
<tr>
<td>FirstName</td>
<td><form:input path="first_name" /></td>
</tr>
<tr>
<td>LastName</td>
<td><form:input path="last_name" /></td>
</tr>
<tr>
<td>Group Id</td>
<td>
<select name="GroupId">
<c:forEach items="${users.al}" var="item">
<option value="${item.value}">${item.value}</option>
</c:forEach>
</select>
</td>
<tr>
<td colspan="2" align="center"><input type="submit" value="Save"></td>
</tr>
</table>
Please let me know how to get ArrayList attribute from ModelObject of 'users' and print those values of ArrayList as DROPDOWN Menu in JSP.
Actually I send that 'users' model object from the Controller of the Spring MVC

<form:select spring mvc shows the object as a string

Hi all I am using spring mvc and I have a form where I have to use a combo box in step a list of objects driver to be loaded into the combo box but it turns out I show it as a string and not as the object .
a little above I have a combo box where I pass in the same way but is out of form and position with JSTL.
what I need is that the first two attributes of my object is loaded for the combo box
Here is the code and images so they can help me.
Controller
#RequestMapping(value="products.htm", method=RequestMethod.GET)
public String homeSuppliers(#RequestParam(required=false) String state, ModelMap model){
try {
if (state != null) {
model.addAttribute("state", state);
}
List<ProveedoresDTO> listSupplier = supplierService.getAllSuppliersDTO();
List<ProductosDTO> listProducts = productService.getAllProductsDTO();
model.addAttribute("listProducts",listProducts);
model.addAttribute("listSupplier",listSupplier);
model.addAttribute("productAtt", new ProductsDTO());
} catch (Exception e) {
model.addAttribute("msg",e.getMessage());
}
return "productsView/products";
}
JSP
<select id="comboProducts" onchange="BuscaProductPorId()">
<option value="0"></option>
<c:forEach items="${listProducts}" var="product">
<option value="${product.productID}">${product.productName}</option>
</c:forEach>
</select>
<h1>${msg}</h1>
<form:form commandName="productAtt" action="crearProduct" method="get"
id="formSend">
<fieldset>
<legend>Product</legend>
<form:hidden path="productID" />
<table>
<tr>
<td><form:label path="productName">Nombre Product</form:label></td>
<td>:</td>
<td><form:input path="productName" /></td>
<td><form:errors path="productName" /></td>
</tr>
<tr>
<td><form:label path="supplierID">Select Supplier</form:label></td>
<td>:</td>
<td><form:select path="supplierID" multiple="false" items="${listSupplier}"></form:select></td>
<td><form:errors path="supplierID" /></td>
</tr>
<tr>
<td><form:label path="quantityPerUnit">Cantidad por Unidad</form:label></td>
<td>:</td>
<td><form:input path="quantityPerUnit" /></td>
<td><form:errors path="quantityPerUnit" /></td>
</tr>
<tr>
<td><form:label path="unitPrice">Precio Unitario</form:label></td>
<td>:</td>
<td><form:input path="unitPrice" /></td>
<td><form:errors path="unitPrice" /></td>
</tr>
<tr>
<td><form:label path="unitsInStock">Unidades en Stock</form:label></td>
<td>:</td>
<td><form:input path="unitsInStock" /></td>
<td><form:errors path="unitsInStock" /></td>
</tr>
<tr>
<td><form:label path="unitsOnOrder">Unidades en Orden</form:label></td>
<td>:</td>
<td><form:input path="unitsOnOrder" /></td>
<td><form:errors path="unitsOnOrder" /></td>
</tr>
<tr>
<td><form:label path="reorderLevel">Nivel de Orden</form:label></td>
<td>:</td>
<td><form:input path="reorderLevel" /></td>
<td><form:errors path="reorderLevel" /></td>
</tr>
<tr>
<td><form:label path="discontinued">Descontinuado</form:label></td>
<td>:</td>
<td><form:input path="discontinued" /></td>
<td><form:errors path="discontinued" /></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td><input type="submit" value="Crear Product" name="crea"
id="crea"></td>
<td><input type="button" onclick="formReset()"
value="Limpiar Campos" /></td>
</tr>
</table>
</fieldset>
</form:form>
Result
You are not specifying what to use for your options. Try this:
<form:select path="supplierID" multiple="false">
<form:options items="${listSupplier}" itemValue="SupplierID" itemLabel="CompanyName"/>
</form:select>
Please note the items name has been changed to match the one given by the #Controller

JSTL Calculate total of bean values [duplicate]

This question already has answers here:
Calculate total sum of all numbers in c:forEach loop
(7 answers)
Closed 6 years ago.
after a loop runs and populates a data table I want to calculate the totals of the columns and display them on the last row.
This is my code to populate the table...I need to build the last row:
<table class="data_table">
<tr>
<th>Source Of Issues</th>
<th>First Issues</th>
<th>second Issues</th>
<th>Changes</th>
</tr>
<c:forEach var="bean" items="${beans}" varStatus="loopCount">
<tr>
<td>${bean.sorCode}</td>
<td class="right"><fmt:formatNumber value='${bean.firstissue}'
type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${bean.secondissue}'
type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${bean.changes}'
type="currency" groupingUsed='true' /></td>
</tr>
</c:forEach>
</table>
<c:set var="sum" value="${0}"/>
<c:forEach var="bean" items="${beans}" varStatus="loopCount">
<c:set var="total" value="${bean.actualLabor + bean.plannedLabor}"/>
<tr>
<td>${bean.sorCode}</td>
<td class="right"><fmt:formatNumber value='${bean.firstissue}'
type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${bean.secondissue}'
type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${changes}'
type="currency" groupingUsed='true' /></td>
</tr>
<c:set var="sum" value="${sum + changes}"/>
</c:forEach>
<fmt:formatNumber value='${sum}' type="currency" groupingUsed='true' />
<table class="data_table">
<tr>
<th>Source Of Issues</th>
<th>First Issues</th>
<th>second Issues</th>
<th>Changes</th>
</tr>
<c:set var="plannedSum" value="${0}"/>
<c:set var="actualSum" value="${0}"/>
<c:set var="changesSum" value="${0}"/>
<c:forEach var="bean" items="${beans}" varStatus="loopCount">
<c:set var="plannedSum" value="${plannedSum + bean.firstissue}"/>
<c:set var="actualSum" value="${actualSum + bean.secondissue}"/>
<c:set var="changesSum" value="${changesSum + bean.changes}"/>
<tr>
<td>${bean.sorCode}</td>
<td class="right"><fmt:formatNumber value='${bean.firstissue}' type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${bean.secondissue}' type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${bean.changes}' type="currency" groupingUsed='true' /></td>
</tr>
</c:forEach>
<tr>
<td><a>Totals</a></td>
<td class="right"><fmt:formatNumber value='${plannedSum}' type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${actualSum}' type="currency" groupingUsed='true' /></td>
<td class="right"><fmt:formatNumber value='${changesSum}' type="currency" groupingUsed='true' /></td>
</tr>
</table>

code too large for try block

Eclipse compiles and runs this jsp just fine but when I deploy to Sun One 6.1 I get "Code too large for try { "
I'm trying to loop over a list of beans while performing aggregate summaries. Any suggestions on how to refactor this to get it to work on our outdated server?
<c:set var="ahJan" value="20" scope="request" />
<c:set var="ahTot" value="246" scope="request" />
<table border="0" width="95%" cellspacing="0" cellpadding="0" class="tableBlackBorder">
<tr>
<td>
<table width="100%" border="0" cellpadding="1" class="tableInternalBorder" id="sortable">
<tr>
<td class="tl">Source</td>
<td class="tl">Program</td>
<td class="tl">Project</td>
<td class="tl">Contract</td>
<td class="tl">Line Code</td>
<td class="tl">Jan</td>
<td class="tl">Total</td>
</tr>
<c:set var="prevProgram" value="" scope="request" />
<c:set var="prevProject" value="" scope="request" />
<c:set var="prevContract" value="" scope="request" />
<c:set var="prevLinecode" value="" scope="request" />
<c:set var="prevBusArea" value="" scope="request" />
<c:set var="ctc_totSub" value="" scope="request" />
<c:set var="plan_totSub" value="" scope="request" />
<c:forEach var="gap" items="${list}" varStatus="status">
<c:if test="${status.first}">
<tr>
<td class="o" NOWRAP>Plan</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.pjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.plineSum}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>CTC</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctcjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctclineSum}" /></td>
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<c:set var="deltaJan" value="${gap.pjan-gap.ctcjan}" />
<c:set var="deltaSubTotal" value="${gap.plineSum-gap.ctclineSum}" />
<c:set var="programDeltaJan" value="${deltaJan}" />
<c:set var="programDeltaSubTotal" value="${deltaSubTotal}" />
<c:set var="planProgramSubTot" value="${gap.plineSum}" />
<c:set var="ctcProgramSubTot" value="${gap.ctclineSum}" />
<tr>
<td class="o" NOWRAP>Delta Hrs</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaJan}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaSubTotal}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>Delta Heads</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan/(ahJan*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaJan/(ahJan*8)}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal/(ahTot*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaSubTotal/(ahTot*8)}" /></td>
</tr>
</c:if>
<c:if test="${gap.program_name == prevProgram}" >
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<tr>
<td class="o" NOWRAP>Plan</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.pjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.plineSum}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>CTC</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctcjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctclineSum}" /></td>
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<c:set var="deltaJan" value="${gap.pjan-gap.ctcjan}" />
<c:set var="deltaSubTotal" value="${gap.plineSum-gap.ctclineSum}" />
<c:set var="programDeltaJan" value="${programDeltaJan+deltaJan}" />
<c:set var="programDeltaSubTotal" value="${programDeltaSubTotal+deltaSubTotal}" />
<c:set var="planProgramSubTot" value="${planProgramSubTot+gap.plineSum}" />
<c:set var="ctcProgramSubTot" value="${ctcProgramSubTot+gap.ctclineSum}" />
<tr>
<td class="o" NOWRAP>Delta Hours</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaJan}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaSubTotal}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>Delta Heads</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan/(ahJan*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaJan/(ahJan*8)}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal/(ahTot*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaSubTotal/(ahTot*8)}" /></td>
</tr>
</c:if>
<c:if test="${gap.program_name != prevProgram && !status.first}" >
<tr>
<td class="CTCProgramSummary" colspan="5">Gap Summary for Program: <c:out value="${prevProgram}" /></td>
<td class="CTCProgramSummary" style="background-color: <c:if test='${0>programDeltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${programDeltaJan}" /></td>
<td class="CTCProgramSummary" style="background-color: <c:if test='${0>programDeltaDec}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${programDeltaDec}" /></td>
<c:set var="delta" value="${planProgramSubTot-ctcProgramSubTot}" />
<td class="CTCProgramSummary" style="background-color: <c:if test='${0>delta}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${delta}" /></td>
<c:set var="BusAreaDeltaJan" value="${BusAreaDeltaJan+programDeltaJan}" />
<c:set var="BusAreaDeltaSubTotal" value="${BusAreaDeltaSubTotal+programDeltaSubTotal}" />
<c:set var="planBusAreaSubTot" value="${planBusAreaSubTot+planProgramSubTot}" />
<c:set var="ctcBusAreaSubTot" value="${ctcBusAreaSubTot+ctcProgramSubTot}" />
<c:set var="programDeltaJan" value="" />
<c:set var="programDeltaSubTotal" value="" />
<c:set var="planProgramSubTot" value="" />
<c:set var="ctcProgramSubTot" value="" />
</tr>
<c:if test="${gap.business_area == prevBusArea}" >
<tr>
<td class="o" NOWRAP>Plan</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.pjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.plineSum}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>CTC</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctcjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctclineSum}" /></td>
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<c:set var="deltaJan" value="${gap.pjan-gap.ctcjan}" />
<c:set var="deltaSubTotal" value="${gap.plineSum-gap.ctclineSum}" />
<c:set var="programDeltaJan" value="${programDeltaJan+deltaJan}" />
<c:set var="programDeltaSubTotal" value="${programDeltaSubTotal+deltaSubTotal}" />
<c:set var="planProgramSubTot" value="${planProgramSubTot+gap.plineSum}" />
<c:set var="ctcProgramSubTot" value="${ctcProgramSubTot+gap.ctclineSum}" />
<tr>
<td class="o" NOWRAP>Delta Hours</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaJan}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaSubTotal}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>Delta Heads</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan/(ahJan*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaJan/(ahJan*8)}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal/(ahTot*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaSubTotal/(ahTot*8)}" /></td>
</tr>
</c:if>
<c:if test="${gap.business_area != prevBusArea && !status.first}" >
<tr>
<td class="CTCBusAreaSummary" colspan="5">Gap Summary for Business Area: <c:out value="${prevBusArea}" /></td>
<td class="CTCBusAreaSummary" style="background-color: <c:if test='${0>BusAreaDeltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${BusAreaDeltaJan}" /></td>
<c:set var="delta" value="${planBusAreaSubTot-ctcBusAreaSubTot}" />
<td class="CTCBusAreaSummary" style="background-color: <c:if test='${0>delta}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${delta}" /></td>
<c:set var="totalDeltaJan" value="${totalDeltaJan+BusAreaDeltaJan}" />
<c:set var="totalDeltaSubTotal" value="${totalDeltaSubTotal+BusAreaDeltaSubTotal}" />
<c:set var="planTotal" value="${planTotal + planBusAreaSubTot}" />
<c:set var="ctcTotal" value="${ctcTotal + ctcBusAreaSubTot}" />
<c:set var="BusAreaDeltaJan" value="" />
<c:set var="BusAreaDeltaSubTotal" value="" />
<c:set var="planBusAreaSubTot" value="" />
<c:set var="ctcBusAreaSubTot" value="" />
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<tr>
<td class="o" NOWRAP>Plan</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.pjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.plineSum}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>CTC</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctcjan}" /></td>
<td class="oRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap.ctclineSum}" /></td>
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<c:set var="deltaJan" value="${gap.pjan-gap.ctcjan}" />
<c:set var="deltaSubTotal" value="${gap.plineSum-gap.ctclineSum}" />
<c:set var="planProgramSubTot" value="${planProgramSubTot+gap.plineSum}" />
<c:set var="ctcProgramSubTot" value="${ctcProgramSubTot+gap.ctclineSum}" />
<tr>
<td class="o" NOWRAP>Delta Hours</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaJan}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${deltaSubTotal}" /></td>
</tr>
<tr>
<td class="o" NOWRAP>Delta Heads</td>
<td class="o" NOWRAP><c:out value="${gap.program_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.project_name}" /></td>
<td class="o" NOWRAP><c:out value="${gap.contract}" /></td>
<td class="oLeft"><c:out value="${gap.linecode}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaJan/(ahJan*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaJan/(ahJan*8)}" /></td>
<td class="oRight" style="background-color: <c:if test='${0>deltaSubTotal/(ahTot*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${deltaSubTotal/(ahTot*8)}" /></td>
</tr>
<c:set var="programDeltaJan" value="${programDeltaJan+deltaJan}" />
<c:set var="programDeltaSubTotal" value="${programDeltaSubTotal+deltaSubTotal}" />
</c:if>
</c:if>
<c:set var="prevLinecode" value="${gap.linecode}" />
<c:set var="prevContract" value="${gap.contract}" />
<c:set var="prevProgram" value="${gap.program_name}" />
<c:set var="prevProject" value="${gap.project_name}" />
<c:set var="prevBusArea" value="${gap.business_area}" />
<c:if test="${status.last}" >
<tr>
<td class="CTCProgramSummary" colspan="5">Gap Summary for Program: <c:out value="${prevProgram}" /></td>
<td class="CTCProgramSummary" style="background-color: <c:if test='${0>programDeltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${programDeltaJan}" /></td>
<td class="CTCProgramSummary" style="background-color: <c:if test='${0>programDeltaDec}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${programDeltaDec}" /></td>
<c:set var="delta" value="${planProgramSubTot-ctcProgramSubTot}" />
<td class="CTCProgramSummary" style="background-color: <c:if test='${0>delta}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${delta}" /></td>
<c:set var="BusAreaDeltaJan" value="${BusAreaDeltaJan+programDeltaJan}" />
<c:set var="planBusAreaSubTot" value="${planBusAreaSubTot+planProgramSubTot}" />
<c:set var="ctcBusAreaSubTot" value="${ctcBusAreaSubTot+ctcProgramSubTot}" />
<c:set var="planProgramSubTot" value="" />
<c:set var="ctcProgramSubTot" value="" />
</tr>
<tr>
<td class="CTCBusAreaSummary" colspan="5">Gap Summary for Business Area: <c:out value="${prevBusArea}" /></td>
<td class="CTCBusAreaSummary" style="background-color: <c:if test='${0>BusAreaDeltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${BusAreaDeltaJan}" /></td>
<c:set var="delta" value="${planBusAreaSubTot-ctcBusAreaSubTot}" />
<td class="CTCBusAreaSummary" style="background-color: <c:if test='${0>delta}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${delta}" /></td>
<c:set var="totalDeltaJan" value="${totalDeltaJan+BusAreaDeltaJan}" />
<c:set var="planTotal" value="${planTotal + planBusAreaSubTot}" />
<c:set var="ctcTotal" value="${ctcTotal + ctcBusAreaSubTot}" />
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
<tr>
<td colspan="18" class="TableRowBGSubNav"></td>
</tr>
</c:if>
</c:forEach>
<tr>
<td colspan="5" class="CTCTotalSummary">TOTAL Gap Summary Hours:</td>
<td class="CTCTotalSummary" style="background-color: <c:if test='${0>totalDeltaJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${totalDeltaJan}" /></td>
<c:set var="delta" value="${planTotal-ctcTotal}" />
<td class="CTCTotalSummary" style="background-color: <c:if test='${0>delta}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${delta}" /></td>
</tr>
<tr>
<td colspan="5" class="CTCTotalSummary">TOTAL Gap Summary Heads:</td>
<td class="CTCTotalSummary" style="background-color: <c:if test='${0>totalDeltaJan/(ahJan*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${totalDeltaJan/(ahJan*8)}" /></td>
<c:set var="delta" value="${planTotal-ctcTotal}" />
<td class="CTCTotalSummary" style="background-color: <c:if test='${0>delta/(ahTot*8)}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${delta/(ahTot*8)}" /></td>
</tr>
<tr>
<td colspan="5" class="CTCTotalSummary">Accounting Hour Summary </td>
<td class="CTCTotalSummary" style="background-color: <c:if test='${0>ahJan}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${ahJan}" /></td>
<c:set var="delta" value="${planTotal-ctcTotal}" />
<td class="CTCTotalSummary" style="background-color: <c:if test='${ahTot}'>#FF0000</c:if>" ><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="1" value="${ahTot}" /></td>
</tr>
</table>
</td>
</tr>
</table>
EDIT:
Tried using forTokes as such:
<c:forTokens
items="ctcjan, ctcfeb, ctcmar, ctcapr, ctcmay, ctcjun, ctcjul, ctcaug, ctcsep, ctcoct, ctcnov, ctcdec, ctclineSum"
delims=", " var="curField">
<td class="TableOutputTextRight"><fmt:formatNumber type="number" minIntegerDigits="1" maxFractionDigits="0" value="${gap[curField]}" /></td>
</c:forTokens>
Still Too Large. Any other trimming-down ideas?
EDIT:
So basically my fix was to remove a lot of the aggregate details. I've put in an IT request to get Glassfish or JBoss. I've been read about JSF and it looks awesome!
The size limit in Java for a method is 65535 characters. You need to refactor that code. This website here has a solution. From the Java Spec:
The length of field and method names, field and method descriptors,
and other constant string values is limited to 65535 characters by the
16-bit unsigned length item of the CONSTANT_Utf8_info structure
(ยง4.4.7). Note that the limit is on the number of bytes in the
encoding and not on the number of encoded characters. UTF-8 encodes
some characters using two or three bytes. Thus, strings incorporating
multibyte characters are further constrained.
Apparently, this is common with dynamically generated JSP.
And, since you may be blocked at work - here is the recommended solution from that site:
Help your container modularize the code. Try splitting the JSP into
several chunks and make dynamic includes instead of static ones.
Dynamic includes (jsp:include against %#include) will compile the JSP
and then stream the output instead of trying to include all the code
into one big method or try catch block.

Categories