Mark Brownengland

+ Follow
since Apr 30, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Brownengland

I have a re-occuring problem on multiple Java based projects I am involved in that would appear to be ripe to be addressed by a common design pattern.

The premise of the problem is: There is a need for concurrent data processing that requires use of a shared resource set which is persisted in a database.

The solution should: Ensure data integrity, provide high performance and ensure there are no deadlocks.

The expected behaviour is: A thread is able to query the database and to be returned the next highest priority resource and then within the same transaction is able to persist a modified state of that resource. Within the lifecycle of that thread, an additional resource is able to be persisted in certain situations.

Constraints: The current persistence technology adopted is a schemaless DB which only offers database level locking.

With the exception of the above constraint, the above problem appears to be quite a common problem so I'd appreciate knowing if there are any related enterprise/architecture design patterns which optimally solve this problem?

Also interested to know the technology stack that you would use to meet the solution requirements and expected behaviour?


thanks for the reply. Its true I am using multiple variables which are pointing to the same directory. I don't believe however that this should be causing a problem. I will try verbose mode to see if this reveals anything.

Just to add, there are no errors when running the ant script, just the generated html that junitreport produces contains no test results i.e. does not appear to be picking up the xml files produced by junit.

Appreciate any thoughts on anything that might be wrong with the above ant script.

Thanks in advance,

12 years ago

I have created the following ant script which runs some junit tests (harnessing selenium) to test the web UI. This all works fine and I can see the resulting TEST*.xml files. For some reason though, when junitreport has completed generating its html files and I open the index.html, the page contains no test results.

My ant script is as follows:

I have two classes in my bin directory as follows:


This produces 2 XML files in my reports directory:


My directory structure is as follows:

bin/ - contains the junit .class files
src/ - contains the junit .java files
test/results/junit/ - this contains the XML and junitreport html files

appreciate if anyone can see anything glaring as to why junitreport is not picking up on the xml files and outputting them in the resulting html files.

Thanks in advance,

12 years ago

After further testing, it seems that adding return false has had no impact. To differentiate between submitting from the onclick and the href, I have purposefully made the href a random value in the example quoted below:

On my browser (safari v4.0.3), the return false has no effect & the browser instead attempts to go to the href location i.e. differentAction_mB.action

Is this a browser issue or have I add the return value incorrectly.

12 years ago
Sorry for the earlier confusion. When I first posted, the a link had changed to rel=nolink which I failed to spot but subsequently re-corrected through using alternative character encoding.

I have now rectified this particular problem although I still have the problem in a related post concerning retrieving hidden (s:hidden) attributes in an action that implements RequestAware. I will re-post on the related thread.

In answer to your javascript dependency comment, I wish to make my app interoperable across browsers & local settings as possible as I will have little control over the environment of each user. I have updated my a tag to also forward to the same action, setting each request parameter as part of the URL string.
12 years ago

But that's the whole point. I'm not setting anything in the anchor as I've got an event intercept i.e. onclick which alters the form's action & then submits the form. I'm expecting that on form submission, the action I've altered my form to execute would be invoked upon calling submit(). This does not happen and instead, the location in the href is simply invoked.

I've debugged to check that the action viewA_doSomething.action is not being invoked & I can confirm this is the case.
12 years ago

Having spent the last 3/4 hour doing something relatively straightforward, I would appreciate some advice. In the past, I've created a jsp containing hidden attributes. I've then retrieved them from an action and made use of their value.

For some reason, I have an action which does not appear to be picking up the hidden attributes from request scope.

The snippet from the jsp in question containing the hidden attribs is as follows:

when submitting this form via the input, this forwards to the action viewA, executing method aMethod. A snippet from this action:

If I debug in Eclipse, I can see these hidden attributes in the request's parameter map. This was also the case in the other action which works.

For some reason, calling get for attrib1 & attrib2 results in null values.

Would appreciate any pointers as to why this may be happening.
12 years ago
I have the following form tag:

inside the form, I have the following hyperlink

When clicking on this hyperlink, instead of going to: viewA_doSomething.action, the href is used and attempts to go to 'blah'.

If I use an input (I do however want to use a hyperlink), this does work and submits the form having substituted its action to: viewA_doSomething.action

Do I need to use a different tag to get my hyperlink to correctly submit the form or am I missing something obvious?

Thanks in advance.

12 years ago

I'm trying to create an int/Integer variable in my jsp using s:set. I then perform a check using a s:if making use of the integer variable I just created. Finally, I would like to increment this jsp set integer variable for each iteration in my s:iterator dependent upon satisfying a particular condition i.e. index % 6.

I would appreciate an example of how I could achieve this using these struts 2 tags.

Thanks in advance.
12 years ago
Now sorted. It seems the # is always required. If using the form: %{} what is the need for inserting a # symbol before the variable name?
12 years ago
That's worked. I would appreciate an explanation as to why an int evaluation requires a #:

whereas a boolean primitive evaluation doesn't:

12 years ago

I have the following code snippet for iterating over a list and outputting index values based upon verifying the index number equals 0:

Before creating the above, I had the following:

This correctly outputted the index number for all elements in the iterator.

For some reason, when I include an s:if tag (as per my first snippet) and attempt to test the rowStatus index i.e. rowStatus.index == 0, this fails to evaluate and thus is never evaluated as true. As an aside, if I altered the first code snippet to:

In this instance, the s:if tag evaluates the test and alternately prints out the index number.

Would appreciate advice as to why I can't use the rowstatus.index inside an s:if tag.

Thanks in advance.
12 years ago
My mistake, the RolesInterceptor quoted in the previous post is actually a custom interceptor i.e. not org.apache.struts2.interceptor.RolesInterceptor

I will keep looking for further info, though would appreciate any advice from anyone who has made use of this interceptor.

Many Thanks
13 years ago
I don't think this is the case. It seems to rely on the setting of specific session scoped variables. My source of reference for the implementation of the Struts 2 RolesInterceptor is:

If you click on the image for the RolesInterceptor, you will see that it appears to retrieve the value of 'role' session variable and cross-references with the roles that are set against the action.

My loginAction contains the following snippet:

I have also tried adding: session.put('authenticated', Boolean.TRUE) & setting USER_HANDLE to a value of 'user'. In both cases this makes no difference. When a user is logged into the system with the 'role' variable set to 'member', the user still receives a HTTP 403 when attempting to go to an action which includes this role in its allowedRoles list.

I would be obliged for further advice.

Thanks in advance
13 years ago