Andre LeDuc

Greenhorn
+ Follow
since Mar 08, 2006
Merit badge: grant badges
For More
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 Andre LeDuc

I want to "page" (break into segments) a HTML table.

I iterate through the table entries with the JSTL <forEach> tag.

My paging logic is encapsulated in a class where I maintain the itemsCollection and the current page indexes. I have two buttons on the JSP page for the user to scroll the itemsCollection forward or backward.
The problem is that the scrolling function will skip every other scroll group. Example: There are 15 items in the collection. The table initially display items 1 thru 5. Click the Next button and items 11 thru 15 are displayed. Click the Prev button and items 1 thru 5 are displayed. Items 6 thru 10 are skipped. Moreover, this problem is intermittent. Sometimes items 6 thru 10 will display in either the forward or backward direction, but I can't predict or control when that will happen.
I'm pretty sure this is not a fault in my paging logic. I've tracked it in the debugger, and what happens when a segment is skipped is that the JSP page is never rendered. The Struts action is called again as if the page had been rendered and the Next button had been clicked, but of course that did not happen (at least there doesn't seem to be any telltale flicker of the screen as I would expect to see if the page were rendered again). My action class returns only one mapping, "Success", and that maps to the JSP page in question.
What I've tried so far is substituted JSTL's <c:url> tags for the <html:link> tags, but that made no difference. Any help?
17 years ago
1 - You need a declaration for the html taglib, like the one you have for the logic taglib.

2 - Be sure to read the docs for the taglibs. This one is for <html:link>. You probably want to code your link like this: <html:link action="/TestAction" ...>
17 years ago
Here's what I really want to do:but of course Java does not support multiple inheritance.
17 years ago
Thanks Merril, that makes sense actually. DispatchAction is my next stop.

A somewhat related problem: For all my other actions I've coded an abstract class BaseAction that extends org.apache.struts.action.Action and my "user actions" extend BaseAction. In BaseAction I've got some methods that I consistently use from all actions. The execute() method is coded like this:
executeAction() is an abstract method that I implement in my sub-classes.

Is there a way I can use Struts' other action classes (like DispatchAction) and still use the code I've coded in BaseAction without merely creating a BaseDispatchAction and repeating myself?
17 years ago
I'm using org.apaches.struts.actions.LookupDispatchAction to process different form submissions from the same page. There are several buttons on the page that will submit the form. I want a specific method in the Action class to process a specific form button. That's what LookupDispatchAction is for, right?

My problem is that it seems that buttons must be labelled distinctly, but I want to label them all with the same value.

Here's a represenative button declaration on the page:


This is how I've declared the labels in ApplicationResources:


In my Action class (which extends LookupDispatchAction), the keyMethodMap looks like this:


My struts-config is set up properly and the page renders correctly. But when I click one of the submit buttons, the most observed behavior is this: The method that gets called is the one associated with whatever message key appears last in ApplicationResources. In the scenario above, sumSales() is called regardless of which button I click. If I recode ApplicationResources such that the order is reversed (button,3, button.2, button.1), then sumInventory() is called - whatever button I click. If I rename the labels in ApplicationResources, e.g.

everything works fine.

I thought the whole point of LookupDispatchAction was to be able to use buttons with the same label but call different methods? I'm using Struts 1.1. Can this be a bug?
17 years ago
I do have the DOCTYPE statement included but it makes no difference.

This is the welcome page to a site and all it is is static text detailing how the site works - instructions basically, so there is no form per se, and no request parameters. I code the action attribute on <html:link> to forward directly to a org.apache.struts.Action instance that does app setup. The reason I'm wrapping a button in a link is because I don't have the time to create the images and for right now, the buttons give me glyphs as a proxy for proper images. For this iteration of the app, all I want to do is get something in front of the users so they can verify that I have all the right stuff in the right places so we can make any major content, navigation and business logic changes earlier rather than later. Later on I'll go back and style the pages and create the images. Truth is though, I struggle with technologies like CSS and PhotoShop. To solve my immediate problem though, I'll probably just use text for the links.

Thanks for your help. This is my first time posting to JavaRanch and I appreciate the response.
18 years ago
I have the following snippet in my JSP page:

This code works fine in Firefox but fails in IE. When I say "fail" I mean nothing at all happens (save for a hiccup on the button). If I swap the comments, the link works in both browsers. The rendered HTML in the view source is identical for both. Is this behavior fallout from the browser wars or am I overlooking something fundamental? I really would prefer to use a button as opposed to an image. Is there some other way to do this so it works in any browser?

Thanks to all who reply ...
18 years ago