Kwa Kil On Swa

Monday, January 22, 2007

JSP Errors

This is a nasty error to debug- all I got was this:

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
Type mismatch: cannot convert from null to int
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)


To debug it, try setting

<property name="jsp.precompile" value="false"/>

(UPDATE: Did I mean <property name="precompile.jsp" value="true"/>)

and then rebuild

I got an error message telling me exactly where the problem was

Monday, January 15, 2007

Diff tools for PostgreSQL database schemas

From files:
apgdiff.sourceforge.net

from DB or files:
pgdiff.sourceforge.net

Saturday, January 13, 2007

Running fimsship with derby on another machine

On remote machine (lets call it "shuttle")

Put the derby db in C:\apps\apache-tomcat-5.5.20\bin\fims_dev_ship

SET DERBY_HOME=C:\apps\db-derby-10.2.2.0-bin
SET DERBY_OPTS=-Dderby.system.home=C:\apps\apache-tomcat-5.5.20/bin

Modify C:\apps\db-derby-10.2.2.0-bin\startNetworkServer.bat to read

:runNoClasspath
"%_JAVACMD%" %DERBY_OPTS% -Dderby.drda.host=0.0.0.0 -classpath "%LOCALCLASSPATH%" org.apache.derby.drda.NetworkServerControl start
goto end

:runWithClasspath
"%_JAVACMD%" %DERBY_OPTS% -Dderby.drda.host=0.0.0.0 -classpath "%CLASSPATH%;%LOCALCLASSPATH%" org.apache.derby.drda.NetworkServerControl start
goto end



Note: Do NOT be termpted to add "-Dderby.drda.host=0.0.0.0" to DERBY_OPTS or otherwise you cannot stop the server with stopNetworkServer.bat (it will say can't connect to 0.0.0.0)

On the remote machine run
startNetworkServer.bat (and stop it with stopNetworkServer.bat)

On the development machine use this to build a version of fimsship that works with remote derby

ant -f build-ship-dev.xml clean deploy

but make sure that the host is correct in properties-ship-dev.xml

Note: I have had some problems starting the server. "Cannot listen on port 1527 on interface 0.0.0.0. Note sure why, but the fix is to run stopNetworkServer a couple of times and try again.




Friday, January 12, 2007

IE dev Tools ... in a toolbar

see
http://blogs.msdn.com/ie/archive/2007/01/09/ie-developer-toolbar-beta-3-now-available.aspx

download at
http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en

Wednesday, January 10, 2007

fims proto calendar

language of calendar is defined by the lang library imported:
<script src="'inc_cmn/lang/calendar-fr.js'" type="'text/javascript'" language="'JavaScript1.2'"></script>
[16:36:50] ROCHE Laurent says: at the moment we have the FR for Les Douanes and the en-uk (my own version from a en-us) for the prototype.
In this file, the language but also order (month, day) is defined ... and good knows what ! ;)

Sunday, January 07, 2007

Struts Tips

When selecting the ajax/dojo theme on a page you can specify debug=true to get dojo debug messages.
<s:head theme="ajax" debug=true/>

Thursday, January 04, 2007

Struts tags -using the after parameter and custom freemarker templates

<fims:textfieldequipment fieldName="stockManagementQueryCriteria.equipmentNm" template="textequipmentwithpopup"/>

replaced

<fims:textfieldequipment fieldName="stockManagementQueryCriteria.equipmentNm">
<s:param name="after">
<img title="<fmt:message key='equipment.image.title'/>" alt="<fmt:message key='equipment.image.alt'/>"
src='<c:url value="/images/equip_plus.gif"/>' width='21' height='21'
style='vertical-align: top'
onClick='DSopenPopup("popupEditEquipmentSearch.html", "DS_equip", 900,800,30,30);'
/>
</s:param>
</fims:textfieldequipment>

which replaced


<s:textfield label="%{getText('equipmentNm.label')}" name="equipmentSearchQuery.equipmentNm">
<s:param name="after">
<img title="<fmt:message key='equipment.image.title'/>" alt="<fmt:message key='equipment.image.alt'/>"
src='<c:url value="/images/equip_plus.gif"/>' width='21' height='21'
style='vertical-align: top'
onClick='DSopenPopup("popupEditEquipmentSearch.html", "DS_equip", 900,800,30,30);'
/>
</s:param>
</s:textfield>



The custom ftl template used is:

<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/text.ftl" />
<img
src='<@s.url value="/images/equip_plus.gif"/>'
title='<@s.text name="equipment.image.title"/>'
alt='<@s.text name="equipment.image.alt"/>'
width='21' height='21'
style='vertical-align: top'
onClick='DSopenPopup("popupEditEquipmentSearch.html", "DS_equip", 900,800,30,30);'
/>
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" />

Tuesday, January 02, 2007

Raw dwr vesselId->Location List before refactoring

<script type='text/javascript'>
var reply1 = function(data)
{
if (data != null && typeof data == 'object') {
// alert(DWRUtil.toDescriptiveString(data, 2));
var headerValue = $("stockManagementQueryCriteria.locationId").options.item(0).text;
DWRUtil.removeAllOptions("stockManagementQueryCriteria.locationId")
DWRUtil.addOptions("stockManagementQueryCriteria.locationId", [{ name:headerValue, id:''}], "id", "name");
DWRUtil.addOptions("stockManagementQueryCriteria.locationId", data, "id", "name");
}
}
</script>
<s:select
label="%{getText('vesselId.label')}"
name="stockManagementQueryCriteria.vesselId"
id="stockManagementQueryCriteria.vesselId"
list="#application.vessels"
value="%{stockManagementQueryCriteria.vesselId}"
required="false"
listKey="id"
listValue="name"
headerKey=""
headerValue="%{getText('dropdown.header')}"
onchange="
/* Or LocationDao.getLocations(eval($('stockManagementQueryCriteria.vesselId').value), reply1);
$() is a DWRUtil function copied from prototype
*/
var vesselId = DWRUtil.getValue('stockManagementQueryCriteria.vesselId');
// Make sure its not the '- All -' option
if (vesselId != parseInt(vesselId)) {
// If its not a number then get an empty list of locations
vesselId = -1;
}
LookupDao.getLocationsByVesselId(vesselId, reply1);
"
/>