Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Ashok C. Mohan

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

Recent posts by Ashok C. Mohan

I read from amazon that the implementation patterns are in Java. How realistic is this? Are there any programming languages around which are implemented in java? Or did I get the whole implementation pattern confused with the implementation of the language itself? What is the most widely used languages for implementing languages? Will this book get me started in writing a PL for robotics (for example)? Thanks and Welcome to Terence Parr. Welcome to javaranch.
I have been wondering, with all the continuous integration which is quite popular nowadays, it is a waste of space to build 40-50 MB ear files where most of it are external dependencies. Is it such a bad idea to have a separate configuration for your project in jboss (other than minimal, default and all) and maintain the external dependencies in the lib folder of this custom configuration folder instead of inside the war/ear file. What are the cons in such an approach. With maven we can make sure that the correct versions of the jars are always synced with the jboss lib folder on each build. Any thoughts?
10 years ago
Make sure your ear is packaged correctly. It seems, JBoss is not able to find some jars.

org.jboss.deployment.DeploymentException: url file:/C:/Jboss4.0.4GA/server/default/tmp/deploy/tmp42328gdoasis.ear-contents/sax.jar could not be opened, does it exist?


org.jboss.deployment.DeploymentException: url file:/C:/Jboss4.0.4GA/server/default/tmp/deploy/tmp42328gdoasis.ear-contents/gdoasisloadingweb.jar could not be opened, does it exist?

11 years ago
It works only if I specify the navigation in pages.xml. But this triggers a complete reload of the page. If I remove the navigation from the pages.xml, the page does not reload anymore, but so does the data table . The database is updated and if I refresh the page with an F5, the new values are shown.
My main problem is that I show both the list and the create/edit on the same page (like portlets). So I dont want the edit form to reload when I change something in the list. I have done the same for the edit button in the list. When the user clicks the edit button, i populate the data in the edit form by rerendering only the edit form. But when I try to rerender the data table from within a column in the datatable it does not work. I tried with a hardcoded row outside the datatable and everything works fine. It just does not rerender if invoked from inside.
11 years ago
I have a rich:dataTable which has different columns inside. One of the column is a link when clicked changes an attribute of another column in the same table(it changes the value in the database by invoking a method in the Home class). After the click I want to rerender only the table(with the new data). I tried different methods, but I was not satisfied with any of them.

I tried using s:link as well as h:commandLink with a4j:support, the table is correctly rerendered but this causes the entire page to reload. I also tried a4j:commandLink to rerender only the table, but this does not update the view. Am I missing something here? Is it possible to rerender the same table in which the link is a column? Does it have anything to do with the fact that the click of the link triggers a call to the Home class and the table is prepared using a factory in the List class? I noticed that after the database is updated the factory method is not called anymore. I even tried clearing the datamodel directly in the eventContext.
11 years ago

All the book examples are built with Maven


Thats wonderful. I think I will write that plugin and will definitely contribute it to the Seam project.
11 years ago
Seam is not slow, but definitely the way you write code may make seam slower than it should be. Fetching data from backing bean with getter methods is a bad idea as these methods will be invoked many many times during a typical JSF lifecycle. Added to this, seam wires all its components with method interceptors which kick in for every method call to the backing bean. This is what makes your application slow. If you add database access code or other heavy-duty code in any of these methods, matters will become worse and you will end up with an application that crawls at a snails pace! But of course there is a way around. If you use factory methods (methods annotated with @Factory) to prepare your lists and objects which are accessed many times, this will reduce the number of invocations to one. As Jacob rightfully points out here, you should also try annotating the methods which do not require the normal seam method interruption with the @ByPassMethodInterceptors annotation. See a post by Dan Allen here which explains this in detail.
11 years ago
On the same note, does seam plan to use maven instead of ant for build configurations in the future? When can we expect this?
11 years ago
I was disappointed that seam was extensively using ant for deployment. I found maven to be much more versatile than ant for build management. The resources on establishing a hot deployment with maven multi module build configuration are pretty slim out there(especially if we use an ear packaging configuration). I found only two relevant resources to achive this. Unfortunately one works only for a war package configuration and the other relies completely on eclipse jboss tools plugin. Does the book also cover hot deployment scenarios with maven? Does anyone know of any tried and tested method to achieve this. Just to outline what I want; Hot deployment (including hot swapping classes in the container) for seam using a maven multi module ear packaging configuration.
11 years ago

Also don't we loose the decoupling concept we learned in our basics.



When you use seam, seam is the component which decouples your view from the model. All communication between your view and model goes through seam and hence it is quite easy to replace either of them with a different technology seamlessly
11 years ago

Could you please explain it more elaborately?


The page parameters are evaluated upon entering a page. The value is assigned as mapped by the value expression. In your example, the page parameter customerAccountId will set the customerAccountId in the customerAccountHome component. This assignment happens prior to the rendering of the page so that the customerAccountId can be accessed from customerAccountHome. One interesting thing is that this operation is not uni-directional. The value of customerAccountHome.customerAccountId is read by the page parameter. So it is both setting and getting the value of the value expression in that order.

Are they invoked on any method call or on specific method?


The page parameter expressions are evaluated for every s:link or s:button you use in your page. It sets the corresponding backing bean property on every method call to a seam component (unless you specifically avoid it by the annotation @ByPassInterceptors).
11 years ago
I believe the x.java that you refer to is your entity class. In hibernate terms this is the class that is linked directly to your database table. The xList.java class is a Query class which extends from EntityQuery which in turn extends from the Query class. They provide a lot of built-in functionalities like pagination and sorting. This frees the programmer from a lot of cumbersome and repetitive coding to implement these functionalities which are part of most enterprise applications. In JSF terms it works as a backing bean for the list page. The xHome.java class on the other hand manages the CRUD operations for a single managed entity from the list displayed to the user. In JSF terms it works as a backing bean for the edit/create pages. I believe you can think of it more like an EJB home.

These three classes are not mandatory to run a project. You can use an entity class and manage it using an action class.

The page parameters are injected into the seam component when a method in the component is invoked. They are also set back into the context once the method invocation is complete.

I may be wrong. Authors, please correct me if I am.
11 years ago
tricky question, especially with all the authors hanging around. LOL. I dont know how many books are out there on seam. I found the seam documentation itself to be quite informative. I believe the seam team has done a good job on that. I read couple of chapters from Dan Allens Seam in Action and liked it immediately. The best thing about seam in action is that it not only tells you what to do, but it also tells you why. It points out the different problems which are inherent in todays J2EE stack and explains thoroughly how seam fills the gap (seamlessly ) If you are looking for a book with which you can become an expert in seam, Seam in Action is definitely the book for you. Even if you are a beginner, the first couple of chapters provide enough insight that should help you decide if seam is for you.
11 years ago
Yes. The scope is EVENT. We use List and Home classes which extend from EntityQuery and EntityHome. The default scope of List is EVENT and of Home is CONVERSATION. But the problem is not with the scope. It works fine when the JSF tag is written correctly. I am curious to know why there was no error. Instead the factory was invoked two times and the second invocation was without any injections.
11 years ago
When I used a factory for preparing a datamodel, I noticed that the factory is correctly invoked only one time while the page is rendered. But then someone accidentally changed a tag attribute in JSF from value="something" to zzvalue="something" (probably a Ctrl-Z gone wrong ). This caused the entire JSF lifecycle to repeat and the factory was invoked 2 times in one request. This caused mayhem as all the variables of the component were cleared after the first invocation. And when the second invocation occurred the parameters which were passed using the pages.xml were not injected into the component. Can anyone shed some light on why there was no error shown or why seam would not inject the context parameters the second time around? It took many days to find out the problem
11 years ago