Jack J. Jackson

Greenhorn
+ Follow
since Apr 20, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jack J. Jackson

Am admittedly a Maven newbie, but cannot figure out what I need to do to get a JDK 1.5 source compiled. Have added the following to my pom.xml, but to no avail:



When I execute mvn compile, I get a bunch of compile errors on the annotations and for-each loops suggesting I try -source 1.5.

I'm sure I've left out something important, but am too new to Maven 2 to know what it is! :-)

Thanks for any help.

--
jj
18 years ago
Sorry to be so late in thanking you for the response.

I understand the reason you offered, but will have to mark this as a language behavior to know, but not necessarily like.

The argument that a ClassCastException could occur later when accessing the (improperly) cast list makes sense, but it's in the nature of downcasting that the developer is assuming responsibility that the cast is semantically valid after the compiler ensures it is syntactically valid.

So, we say the following cast isn't valid since a later access of list could cause an unexpected ClassCastException...


However, the same unexpected ClassCastException could occur even without the list cast:


However, I take your point that if I call the get() on a List<Foo>, I really expect only Foo object references will be in there, whereas calling the get() on a List<FooI> provides less certainty as to what the "true object at hand" really is.

Thanks again!
[ June 22, 2006: Message edited by: Jack J. Jackson ]
18 years ago
I've been working with Java 5.0 generics for awhile, but am not sure about a casting issue.

Consider the following code:



Since Foo implements FooI, I can cast a FooI reference to a Foo object reference. However, the following implementation of Foo will not work:



The compiler complains that we cannot convert from List<FooI> to List<Foo>.

However, if we iterate across the List of FooI, we can cast each member to a Foo, as in:



Call me dense, but I'm not sure why I can't cast from a List<FooI> to a List<Foo> if I can cast each member of the list to the other type?

Thanks for getting me back on track.
[ April 20, 2006: Message edited by: Jack J. Jackson ]
19 years ago
Okay. I found the cause of the problem.

I was using a MyFaces HtmlDataTable, but a Sun RI HtmlCommandLink was enclosed in a row. Apparently unique ids were not being generated for each row, causing every CommandLink's actionListener to be fired when any CommandLink was clicked. When I switched the DataTable back to RI from MyFaces, a unique id is generated for each row's CommandLink.

I wanted to use the MyFaces "rowindex" attribute. Maybe if I used the MyFaces JSF impl, things would work, but I'm mandated to use the Sun JSF RI implementation. Oh well.

19 years ago
JSF
I'm adding more info to my original post. The following are the artifacts needed to illustrate what I'm talking about:

- faces-config.xml entry



- SimpleItemContainer



- OrderableItem


- simpleList.jsp form element


When a link in a row is clicked, the actionListener method (simpleItemContainer.listener) is fired 10 times. Here's the output after clicking a link:



What I'd like to have happen is have the actionListener method "consume" the event so it's not broadcast 9 times more than is needed.

Since this issue hasn't been raised, I'm sure I've just misconfigured something. (or am doing this all wrong!)

Thanks for any help.

[ March 15, 2006: Message edited by: Jack J. Jackson ]
[ March 15, 2006: Message edited by: Jack J. Jackson ]
19 years ago
JSF
I'm using Sun RI 1.1_01 and MyFaces Tomahawk 1.1.1. Inside a DataTable, I have a CommandLink that appears on each row of data. The CommandLink has an ActionListener bound to a method on a session-scoped bean. Each row has the same client Id.

I just discovered that the ActionListener is fired for every row in the data table; i.e. if there are 100 rows, the actionListener method is invoked 100 times. I'm not sure why this would ever be useful behavior; it certainly isn't for my application.

Why does the actionListener event get fired for each row in the table? Is it because each row has the same id?

I suspect I've configured something incorrectly and would appreciate being steered back on course.

Thanks.
19 years ago
JSF
Is there a way to configure Tomcat 5.0.x to allow hot deployment of individual files that change rather than redeploying the entire WAR?

For instance, when I run into a problem with a JSP, I'd like to fix that JSP and deploy only that changed file to wherever I need to so tomcat will recompile the JSP and use it the next time I request that page.

Same for a Java file. I'd like to signal to Tomcat's classloader that the class files it previously loaded need to be discarded and reloaded.

Thx.
19 years ago
Gerardo, Gregg et al:

Thanks so much for the informative discussion!

I was headed down the bean-per-view approach and this was complicating the state management quite a bit. For instance, View A set state in Bean A, but View B needed to use the state set in Bean A. So I was passing state info from managed bean A to managed bean B, but then I couldn't reliably predict when View A would get the updated state, especially if bean B was request scoped.

I just felt this was all getting a little too complicated for what was a really straight-forward web application.

A sessionScoped controller-per-usecase scenario seems much more reasonable. Then, every bean sees the same state at the same time without passing state around from bean to bean.

Thanks again!

[ February 18, 2006: Message edited by: Jack J. Jackson ]
[ February 18, 2006: Message edited by: Jack J. Jackson ]
19 years ago
JSF
Thanks a lot for the response Gerardo.

For the non-DataTable case, do you recommend a single backing bean for each JSP page like Shale's 1:1 requirement? Or, do you have a single "Controller" bean that keeps data to support multiple views?

Also, how do you trigger the loading of the data after the initial load?

The first reference to the sessionScope backing bean in a JSF component could cause a load of the data, but won't the request processing lifecycle cause that method to be invoked multiple times before the page is ever displayed?

Jack
[ February 16, 2006: Message edited by: Jack J. Jackson ]
19 years ago
JSF

... but we do like to appear professional ...



I guess the one-eyed moosehead graphic threw me off on this...

I'll conform before my next post.
19 years ago
JSF
I have two scenarios where this is used. First, Page A has outputLinks not in a dataTable. The second scenario is, the link is in a row in a dataTable.

Should they be handled differently?
19 years ago
JSF
One of the biggest problems I've faced in moving from Struts to JSF is dealing with the JSF lifecycle. In short, stuff happens to the data in my backing beans and I'm spending too much time trying to get the right data on a page and keep it there, unmolested, throughout the JSF request processing lifecycle.

Here is a simple generic use case on which I'd appreciate some basic JSF advice:

Master-to-Detail Navigation: User clicks on a link on page A. The link passes an id value as a request parm to page B where a query for the details are retrieved and displayed.

Page A uses an HtmlOutputLink component with an enclosed UIParameter control to pass a uniqueId as a request parm to the next page.

The questions I have are for page B's managed bean declared to be in request scope:

1) Where should I get request parm value, and store it, so that it stays available throughout all lifecycle operations on the page?

I've pulled it from the request attributes in the constructor and stored it as a field on the bean, but it seems to get nulled out during a later request processing phase.

2) What do I need to do keep safe the detailed record I get using the unique key passed in as a request parm.

If a validation error is found, the data is still there. However, if I navigate back to that same page (i.e. edit -> invoke save action -> return to page for more edits), that's a new request, so the field reverts to null.

Since JSF posts back to the same page, how do I propagate the uniqueId to the next request (which will be for the same page)?

I know I can keep the bean as a session bean, but I'd like to avoid keeping everything in session just to facilitate what should be (probably is) simple navigation in JSF.

Thanks for any advice.

[ February 15, 2006: Message edited by: madjack ]
[ February 15, 2006: Message edited by: madjack ]
19 years ago
JSF
During startup, Tomcat 5.0.x tries to resolve the DTDs for XML files in my web app. Unfortunately, I'm behind a firewall, so effectively there's no Internet connection for it to find the PUBLIC DTDs.

In the past, I've simply altered the DOCTYPE element to point to local copies of DTD files I'm using in my web app. However, some third party JARs include XML files, and I really don't want to be editing their XML files.

Is there a Tomcat configuration setting that would allow me predeploy all the needed DTDs to Tomcat and make it look there for the DTD files before trying to get an Internet connection?

Also, does Tomcat support the use of the OASIS XML Catalogs? I can export a .xmlcatalog from Eclipse and deploy it with my web app, but I'm not sure if Tomcat would even use it.

Thanks in advance!
19 years ago
I'm exploring Tapestry because it seems to make some hard things in JSP simple. However, there are some simple things in JSP that I haven't figured out the best way to do in Tapestry. One is <jsp:include>.

In JSP, you can insert a common code fragment (i.e. banner or footer) using this really simple tag. What's the best way to do this in Tapestry?

Also, if one wants to read a String from a properties file, for I10N or just to isolate things that frequently change from things that don't, what's the best way to read the keyed value from a resource bundle?

TIA.
20 years ago
Joey (et al),

Thank you all for your responses. I was finally able to find the problem and here is what happened:

The class not being found inherited from another class. It was a JAR file that contained that class that was missing from my deployment. I'm not sure why the ClassLoader was complaining about the subclass not being found instead of the super class, but that's my story and I'm sticking to it!

Thanks again.
20 years ago