Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

arjan tijms

Greenhorn
+ Follow
since Jan 22, 2006
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 arjan tijms

Originally posted by Saskia de Jong:

I would say that showing ONE SINGLE url for a set of pages that forward to eachother is way better than showing the WRONG page. Showing the wrong page is very confusing for users, let alone a true support nightmare.



I've stumbled upon the same problem. My initial solution to this problem is to create a custom view-handler. This view handler doesn't use the requested URL to restore the view, but uses a supplied parameter. If you alter the form in each JSF page to post to a single URL, then you essentially have what is asked above.

A quick and dirty implementation would look like this:



ViewHandlerDecorator is a straighforward class that just wraps the previous installed viewhandler and by default passes everything to this embedded handler:



In your set of JSF pages do something like this:



(remove the _ in the on_click attribute)

For completeness, an additional viewhandler can be installed by putting the following in faces-config.xml:



I've tested this using Myfaces 1.1.1 on Tomcat 5.5.17 with statesaving set to client and everything seems to work. Note that I'm depending on the MyFaces specific parameter "jsf_viewid", so for a more generic method you'll have to do some extra work. As said, the code given above is just a quick and dirty implementation of the idea, but it does show how flexible JSF really is.
15 years ago
JSF

Originally posted by Gerardo Tasistro:
I think the issue here is that the include doesn't issue or create an http request. Thus it isn't filtered through the faces servlet. Hence your .jsf isn't read by the servlet as it is included.



I'm not really sure if that is the issue. If I look at the given stack trace I see a "at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)" line there, so the include surely causes the JSF servlet to be invoked.

I quickly tried the same setup (also tomcat and myfaces), and there's indeed an endless recursion happening. I also tried your solution and it did work, so the OP's problem is solved I think. Nevertheless I'm curious about what is exactly happening here.

It would be interesting to step through the tomcat source (JspServlet would be a candidate) with a debugger to get to the bottom of this. Maybe if I'll have some time tomorrow I'll try to do this.
15 years ago
JSF

Originally posted by Joel McNary:
The one thing about C# that I wish Java had was the ability to implement two interfaces with the same method signature but meant to do different things.



I think that's a clear advantage. Another nice feature of C# that I would love to see in Java is the limited* operator overloading. Obviously atleast some people at Sun think operator overloading is a good idea (namely, the EL engineers and the guy who wrote the Javadoc for BigInteger).

We have operator overloading for Strings, why can't we have it for Collections and Numbers? I think something like myArray[1]; looks more natural than myArray.get(1); This is even more true for Numbers: big1.add(big2.subtract(big3)).devide(big4); (yugh!)

*
(limited when compared to C++)
15 years ago
I'm currently too lazy to setup a test-case myself, but if you're using myfaces you might want to do a source-attachment for your myfaces jars. Then in your favourite IDE, set a breakpoint in UIData.java in the queueEvent(FacesEvent event) method and another one in the broadcast(FacesEvent event)function.

The basic outline of these functions is that events fired by children of DataTable are caught by the parent which requests the current row number associated with the particular child, wraps it in a custom event and fires the event up the chain. Then, in broadcast() the DataModel's cursor is set to the saved row number, then the event handler is invoked, and finally the DataModel is restored to the previous row.

In a debugger you can probably see at which point the wrong row gets selected.
15 years ago
JSF
I wonder what the general opinions are on implementing GUI behaviour in backing beans instead of custom components. As a small example, I have a panelgrid with a few commandlinks and images of flags in them that I would like to show some marker for the selected language.

One aproach would be to let a backing bean discover the currently selected component and dynamically build a matching serie of column CSS classes. E.g.



With the relevant parts in the backing bean being:



The other possible aproach would be to create a custom component that tracks the selection of its own commandlink children. Surely this is not that difficult, but going down that road I'll probably end up with lots of different custom components for all those little GUI behaviours on every page.

What would be the best approach?
15 years ago
JSF