Just another site

Category Archives: SEAM

js script to check ajax page change

We could add break point in firebug to check ajax page changes

<script type=”text/javascript” language=”javascript”>
document.documentElement.addEventListener(‘mouseup’, function(e){
mouseDown = false;
var str = “Mouse up”;




use Jmeter to do performance testing for seam project

1 Use Badboy to record action, export script for Jmeter

2 import script into jmeter

3 We need to handle two things, jsfViewState and conversation ID:

Add URL re-writing modifier for jsfViewState at root level, this only need to be done once


Add regular expression extractor for cid(this should be done at the previous page, before the cid variable get called)


update form data to load value from variables:



4 change all http sampler to use “Follow Redirects”


5 you should be able to run test test scripts now, run test, add “view results tree” listener to check request/response data


clear entered value in model panel

We could use facescontext to clear entered data in model panel.

selectedCustomer = null;

FacesContext context  = FacesContext.getCurrentInstance();
return "";

check whether a request is ajax request

public static boolean isAjax(request) {
return “XMLHttpRequest”.equals(request.getHeader(“X-Requested-With”));


seam code to show current conversations

<h:dataTable value=”#{conversationList}”
<h:commandLink action=”#{}”
<h:outputText value=”[current]”
value=”#{}  ”/>
<h:outputText value=”#{entry.startDatetime}”>
<f:convertDateTime type=”time”

jsf popup panel validation

Around the content with s:validateAll tag, and then add oncomplete attribute on the save button.

<a4j:commandButton oncomplete=”if (#{facesContext.maximumSeverity == null}){Richfaces.hideModalPanel(‘trackingFieldPanel’)}”/>
If there’s any validation error, the window will stay open.

validation on jsf popup model panel

if validation failed , popup should remain open

msgPanel is the output panel inside the  popup model panel

<a4j:commandButton id=”saveActivity” action=”#{createActivity.saveActivity}” value=”Save”
styleClass=”btn alignright btn_green smallFont” reRender=”msgPanel,activitiesList”
oncomplete=”if (#{facesContext.maximumSeverity == null}){closeModalPanel(‘activityPanel’);return false}”/>


Quoted from

We were ending a conversation programatically, by calling Conversation.endBeforeRedirect(). However, there was no redirect, so the conversation lock wasn’t released.

I changed it to be Conversation.end() and then Conversation.leave(), which causes the conversation to end, release the lock and start a new one. And so far no exceptions 🙂


found this from
it came from Seam documentation

Accessing a Seam conversational component from a Ajax request need to be queued serially because as per the seam documentation ,conversational component dont allow concurrency. If the server component takes a long time to respond and if another request goes in, it throws out the “org.jboss.seam.ConcurrentRequestTimeoutException: Concurrent call to conversation” error. After adding the eventsQueue property to the a4j:support tag it stopped throwing out the Error.

The documentation explanation about the eventsQueue.  “eventsQueue – provide a queue in which events are placed. All events are queued and requests are sent to the server serially. This is useful if the request can to the server can take some time to execute (e.g. heavy computation, retrieving information from a slow source) as the server isn’t flooded.
view plainprint?

<a:support event=”onchange”  eventsQueue=”default” action=”#{longRunningComo}” reRender=”Decoration”
bypassUpdates=”true” ajaxSingle=”true”/>

setEntities and LIE

return “”;


the above code throws exception “failed to lazily initialize a collection, no session or session was closed”.
Solution: we should do setEntities before the flush call.

return “”;



@In attribute requires non-null value

I got this exception even I added @In(create=true) didn’t solve the problem.

it turns out that the variable name must match the seam component name.


public class OneplaceGoogleSchedularAction …..


@In(create = true)
OneplaceGoogleSchedular oneplaceGoogleSchedularAction ;