The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)


sahi, suggestion: "_wait(maxTime, condition)" with "AND" functionality, not just "OR" -- stop execution if "condition" returns false

i wish there was an additional "_wait(maxTime, condition)" function that would stop execution if condition returns false.

as of now, it seems as if "wait + condition" continues execution no matter the outcome of "condition", which makes it an "OR" test, but my suggestion would be for an "AND" test, i.e.:
wait, up until maxTime is reached, and if condition is still false, then stop execution.

i want this because of network/server response timing issues, specifically related to ajax operations.

i just posted this as a discussion in the sahi forums:
suggestion for _wait: stop execution if condition returns false

to achieve the same thing today, it looks like you'd have to code it like this:
_wait(10000, _assertTrue(_isVisible(_link("detailsForm:saveAgreementBtn"))));

and this gives the same functionality, but with less code, but also may look potentially confusing:
_wait(10000, _isVisible(_link("detailsForm:saveAgreementBtn")));


[SOLVED] sahi, primefaces: p:dataTable no rendered table tag id

i'm updating our sahi test scripts for our new primefaces frontend and ran into a difficulty when trying to select a specific table row cell.

this page gives a hint as to how to select specific table cells:

using this format:
_cell(_table("<table_identifier>"), x-1, y-1)

but the problem is that when a primefaces p:dataTable gets rendered to HTML, the table is enclosed in a div tag, and that div tag gets the id value set in the p:dataTable code, and the actual table tag doesn't have an id.

i solved my problem like this:
_cell(_table(1, _in(_div("selectMember:selectMemberTable"))), 1, 1)

here i specify the *second* table (there's a table in the header too), which is the actual dataTable table (0-based indexing, so value "1").

however, from what i can see, the sahi documentation is confusing concerning "x" and "y", if you interpret "x" to mean column (left<->right position), like i do.

"...1, 1)", in reality, means "row 2 (x), column 2 (y)" (0-based indexing, so "1, 1")


as a side note, i found this sahi script code useful/interesting too:
_table(0, _in(_div("selectMember:selectMemberTable"))).rows[0].style='background-color:red'

which changes the background color of the first row of the first table to red.

sahi, primefaces: "ReferenceError: PrimeFaces is not defined". solution: just rerun the sahi script

sometimes when i run a sahi script to test our primefaces ui, the script times out with the following error:

ReferenceError: PrimeFaces is not defined (http://localhost/pages/listTransportAgreements.jsf:278)

when i rerun the script, it usually goes away, so i'm not quite sure why it works sometimes and other times it doesn't.


primefaces p:commandLink oncomplete attribute referencing non-existent ID was messing up table filter and sort functions

i had this primefaces delete-icon code in a table row:
<p:commandLink id="deletelink" title="#{msg['label.delete']}"
    action="#{ta_mappingObject.setCurrentItemAndPanelToShow(agreement, 'deleteTA')}"
    rendered="#{!ta_mappingObject.createFromRequestDetails and userMenuBean.canEditAgreement()}"
    <h:graphicImage value="/images/icons/delete.gif" style="border:0" />

and stuff on the page like filtering and sorting wasn't working, so i figured out that because that link was referencing a dialog ID that didn't exist, it was messing up the whole page, so i changed it to this:
<p:commandLink id="deletelink" title="#{msg['label.delete']}"
    action="#{ta_mappingObject.setCurrentItemAndPanelToShow(agreement, 'deleteTA')}"
    rendered="#{!ta_mappingObject.createFromRequestDetails and userMenuBean.canEditAgreement()}"
    <h:graphicImage value="/images/icons/delete.gif" style="border:0" />

and everything started working again.


primefaces - show p:modalPanel from java backing bean / controller class and update specific id or collection of id strings

here's how you show a p:modalPanel from a java backing bean call:

"modalPanelWV" is the widgetVar value, e.g.:
<p:modalPanel id="myModalPanel" widgetVar="myModalPanelWV" ...

update an id from backing bean:

OR update a Collection<String> of IDs:


[SOLVED] jboss 7 jdk 6 startup in debug opens FileNotFoundException.class: Suspended (exception FileNotFoundException) jdk/jre/lib/zi/UTC

i started to encounter something weird when i was starting up my local jboss 7 instance in debug mode (using jdk 6):
FileNotFoundException.class would open in the eclipse debugger

with this error message in the console:
Suspended (exception FileNotFoundException) ~/workspaceEclipse/tcTrunk/jdk/jre/lib/zi/UTC

i figured out that "zi" means "ZoneInfoFile"

i can see that there's a UTC file in zi/Etc/:


all i had to do to fix this was copy the file to the expected folder:

cp ~/workspaceEclipse/tcTrunk/jdk/jre/lib/zi/Etc/UTC ~/workspaceEclipse/tcTrunk/jdk/jre/lib/zi/


[SOLVED] sahi include script does not exist

today's problem started out like this:

### verify_any_transport_requests.sah ###


tc_login($buyer_user_unil, $buyer_pass_unil);




every time i'd try running this script i'd get the following error in the sahi log:
Script: /home/nick/workspaceEclipse/tcTrunk/testing/functional_testing/stage_1/sahi/functions/transport_request_functions.sah does not exist.

since i knew that the include file indeed did exist, i figured it had to be something wrong with the code. then i saw this code in transport_request_functions.sah:


it should have been:

it seems like that was the problem.


web.xml jsf setting to treat empty string values in form submit as null so they're not saved in the database, but also comply with notnull constraints

the following setting in web.xml is quite useful:



which means that when a user submits a form then no empty fields of type string will get saved in the database. having it set to true will also force compliance with @NotNull constraints, with regards to validation.

on a related note, there's a jboss startup setting called org.apache.el.parser.COERCE_TO_ZERO, which when set to true (default) will turn number field form values of "" (empty string) and null into the number 0 (zero) before the form is submitted, e.g.:


setting it to false would mean that empty strings and null values for number fields in forms will be submitted "as is" and NOT get converted to the number 0.


when and why facelets.DEVELOPMENT was replaced by javax.faces.PROJECT_STAGE

was trying today to figure out when and why facelets.DEVELOPMENT was replaced by javax.faces.PROJECT_STAGE and i think i finally found the answer in the following article by IBM:

Changes to XHTML and Java sources of a JSF 2.0 web project not refreshed on publish to the WAS V8 server

facelets.DEVELOPMENT was used in JSF 1.2 (Facelets 1.x)

javax.faces.PROJECT_STAGE has been used since JSF 2 (Facelets 2.0 VDL, Facelets 2.0 API [specifically javax.faces.application.ProjectStage])(see "*** NOTE" below).


*** NOTE
In JavaServer Faces (JSF) 2.0, Facelets is the default view declaration language (VDL) instead of JavaServer Pages (JSP). With Facelets, you don’t need to configure a view handler as you used to do in JSF 1.2. Facelets is a JSF-centric view technology.