Chris Montgomery

Ranch Hand
+ Follow
since Jan 14, 2004
Merit badge: grant badges
For More
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 Chris Montgomery

I'm not sure I'm convinced.

The way I understand it, the result type 'name' attribute is just that. a name. I can chose any string I want - like "json" in your example.
In addition to the name attribute, you must enter a class attribute to point to your custom Result class.
Finally in your action, you should be able to reference that newly created result type by its name.

Tomcat shouldn't care about the name I've used, it's just a pointer to my class isn't it?
My guess is that if you rename your result type from "json" to "myCustomJSON" and reference that in your action configuration, it will still work.

What's actually return is based on what is loaded in your execute method of your Result class.
Here's an example method taken from a tutorial:

As you can see, it's just loading up the response object with 'stuff', so your JSP can do things with it.
I have the action coded and the Result coded, I'm just trying to figure out how to convince Tomcat my configuration is correct!

I actually think I don't even need to go this route. I'm starting to see evidence that I can load up the response object from my action after all (rather than creating a Result class).
I'll post my results.

13 years ago
I feel like I've implemented my custom result type correctly, yet tomcat hates me and refuses to deploy my app...

Error Message:
There is no result type defined for type 'captchaImage' mapped with name 'success'. Did you mean 'captchaImage'? - result -


I'm not using any plugins.
I get the same error whether my jcaptchaImage.action references a class or not
Based on a few book references, it all looks good.

My goal is to have my captcha image's src reference my action:

13 years ago
Many apologies folks. False alarm. the dates weren't even the issue. it was a separate criteria that was the culprit.

For some reason I keep having to relearn the lesson of 'elimination'.
Start removing various factors to weed out the cause.

Hibernate appears to be using a 'fasttime' value?? for my date in its WHERE clause and doesn't return rows that it should from the database:

Here's a 50K foot view of my Doman and DAO objects along with the SQL output.
I'm using annotations for hibernate and have set the temporal type for my date objects to DATE (I've tried all three)



My variables output shows that the start and end date 'criterion' are pointing to the correct property name, but when it comes to the actual value, cdate is null and fasttTme is 1304139600000.

Unfortunately, my log4j.xml isn't responding to TRACE, so I am not able to see the actual parameters I'm hoping I'm still on the right track.

Here's what Hibernate has for a query:

when I use the values from fastTime values, the rows do not come back.
when I use the 'yyyy-MM-dd' equivalent of the fast time values, the query does work.

This is how I was able to confirm the equivalent from the fastTime:

Hoping for a little nudge in the right direction.


Have you investigated jQuery for this?
13 years ago
If you remove the annotations and use just the struts.xml approach, are you able to achieve the desired result?
Annotations may not be the best option for you given the situation.
13 years ago
I would recommend leveraging JSTL. It's just easier at times...

Here's a date example:
<fmt:formatDate value="${myCollection.myValue}" type="date" dateStyle="short" />

as far as your url parameter goes - assuming you actually have a variable in your collection called 'reportdate' that is accessible to your jsp (public getter/setter) , it should work.
13 years ago
I'm not completely sure if what you are doing is trying to manipulate a redirect, but I'm going to assume you are. Here's an example of what you can do with action variables and your struts.xml:

an alternative you can experiment with is something like this:

And depending on what happens within your action, update the value of your myDirectory variable accordingly.

13 years ago
I've struggled with these as well. unchecked boxes basically don't exist.
To be honest, I avoid the struts implementation of checkboxes if I need to get 'fancy'.

An alternative is to create your own checkboxes ( this can be done dynamically ) and assign meaningful id's to each of the checkboxs. From there, you can leverage jQuery's select event along with AJAX to deal with the user selection realtime. No form submit necessary...

This exact solution may not be relevant, but hopefully provides you some alternative perspectives on solving your issue.

13 years ago
I've stumbled through this same issue during validation. I add a hidden form field and preserve the value there.

One catch... I only encounter this when doing an AJAX call (via jQuery in my case). My Action doesn't always have access to the variables in a way that allow me to represent selections, so using jQuery's document.ready implementation I'm able to detect the validation error and use the hidden field to reload the select box since jQuery does have access to the newly entered values.

It doesn't look like you are using jQuery - definitely recommend it. If not possible, there should be enough here to whip something up!

Hope this helps.
13 years ago
You can certainly use the session. Depending on how long you want to hold on to your variables, you may find that the request object will suffice.

Check out JavaBeans and Scope within the Struts documentation.

13 years ago
Sorry was thinking this was Struts 2, I haven't done Struts 1 stuff in ages - but will give it a shot:

Your struts-config action is referencing your products form. do you have that form bean defined in your struts config?

13 years ago
I will reply in the other chain, so you don't have to go back and fourth.
13 years ago
Gerat news!

With projects I'm invovled with that don't use Maven, libraries can be a pain.
If you can, look in to Maven. Maven will manage most of your libraries and dependencies for you.

Netbeans has a project template for a Maven Web Application. I love it!
I haven't done it in Eclipse...
13 years ago
Do you have a public getter and setter defined in your action for your action variable? The public getter is how your struts jsps obtain your action variables. The public setter is how your form submits fill that value.
13 years ago