Help coderanch get a
new server
by contributing to the fundraiser

Casey Cox

+ Follow
since Nov 28, 2008
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 Casey Cox

I am developing a framework of web services that would be given to my team for future development. One of the things I want to do is have a couple of methods that all future webservices support and implement. What is the best way to enforce this? Should I have a "parent" wsdl that all "child" wsdls will import and support? Is there any other way of doing this?

All help much appreciated, thanks!!
15 years ago
I think I found a way to get my stuff to work. I made my action implement ParameterAware and the jsp values are now available in the map. I am not sure if this is the correct way to do it, but it does seem to fulfil my needs, in a somewhat roundabout way.

I have been working on this for almost 2 days, and even though I have a possible solution in hand, I don't feel any relief, only a vague sense of anti-climax..
15 years ago
Well, it seems like I had to declare my object as an Arraylist in the Action, like so:
ArrayList productBOs;
instead of
ProductBO[] productBOs;

So, now I am able to submit the jsp without running into an exception, but I don't get the values in my action.

I can see the setter being called, but the argument is always non null and empty!!

This is how the jsp looks like:

Help, anyone!
[ December 25, 2008: Message edited by: Casey Cox ]
15 years ago
I am stumped with this problem that I have. Any pointers to the solution or related documentation would be greatly appreciated.

My JSP has nested iterators, and the deepest one has a listbox, like so:

The generated source code looks like this:

And it seems to look alright to me. But submit causes a problem because it is not able to find a setter. I am not exactly sure where or how I would write this setter. I have a setter/getter for ProductBOs in the action class. The ProductBO class has a setter for the attributeBOs. What else do I need?

Thanks !

[ December 21, 2008: Message edited by: Casey Cox ]
[ December 21, 2008: Message edited by: Casey Cox ]
15 years ago

Originally posted by David Newton:
I'd probably just put them in a hidden form field via JavaScript, but w/o knowing what exactly you're doing and how, it's hard to say.

Aha, that was all I needed. As you can tell, I am pretty new to front-end programming and basic techniques are usually not entirely obvious to me.
This is great, you saved me a lot of heartache. Thanks!
15 years ago

Originally posted by David Newton:
You are correct; form submission requires an actual submission, otherwise the browser won't append form parameters to the URL (GET) or put them in the request body (PUT). This is basic HTTP/browser behavior.

<s:submit...> takes a "method" attribute that defines the action method that will be submitted to (as well as "action" and "namespace" attributes that do what their names imply), so that part is pretty easy.

Ok, I have changed most of my location.hrefs to s:submits, but there are some instances where I build and append a request parameter.
Most times, these are dynamic values based on what the user chose in a tree or something like that. What would be the best way for me to handle these??

It seems s:submit does not let me embed a s :p aram with a dynamic value.
Using a url href lets me do the parameter part, but I lose the values from my checkboxes.

Is there a way for me to get what I need with s:submit, or should I maybe rethink my need for the request parameters ??

[ December 07, 2008: Message edited by: Casey Cox ]
15 years ago
Thanks much for your help David. But please don't bother with the sanity check for the checkbox. I got the multiple checkboxes to work. I used Strings as values and it works like a charm. No special code change was needed, all I had to do was a proper submit!

Thanks a lot for your time :-)
15 years ago
I think I am in the process of learning a valuable lesson today. I was under the impression any invocation of a server side method is equivalent to a submit. But it seems like its not.

If I called a javascript method in the onClick event which just has a document.location.href pointing to an action, the control goes to the server method alright, but the check box values were missing.
But if I call document.frm.submit, it invokes the execute method and the checkbox values were available.

I have to read up more to understand this behavior.
I also have to figure out how to use s:submit - hopefully this will let me properly submit to different methods - sort of like a StrutsDispatchAction without losing any form values.
I also have to figure out how to extend my one checkbox to multiple checkboxes. Whew... Miles to go before I sleep :-(
15 years ago
To keep things simple, I removed the multiple checkboxes.

I added a single checkbox to another page of the application. This checkbox, on submission, contains the correct boolean value: true or false, depending on whether the user clicked it or not.

The HTML code is:

I now added the same single checkbox to the page I really want it in, but it does not work. When I checked the source, the HTML rendered is exactly the same. The only difference that I can tell (outside of the difference in content) is, the second page where it does not work, is part of a frame rendered by an action. Can this somehow have a bearing??

The geoProd frame is the one where I want the checkbox to work, but it doesn't.
15 years ago
Oh! I tried it and got a null.

I was not sure if this is what we need to do, because this is not we how we get at values for textboxes. For struts2, the values get populated automatically in the Action bean, don't they?
15 years ago
This must be a fairly common need, but I am not able to figure it out for the life of me.

I have a iterator that displays some rows of data. I have added code to include a checkbox, that the user can select, and then on submission, I do something with those records. But no matter what I try, I am not able to get the checkbox values in the Action class. I must be missing something fundamental!!

I don't have any interceptors defined in my struts.xml.
Please let me know if there is any other information I can provide.

Thanks a LOT for your help!
15 years ago
It turns out my web application's structure was not entirely ideal. There wasn't a webroot folder housing the web-inf and other folders. Once I rearranged the project, dojo starting work properly. Whew!!

Thanks all!
15 years ago
Thanks for the idea. I will give it a try.
15 years ago
Hi, I am trying to learn struts2, and what I want to do is display a datetimepicker on a jsp. From tutorials, it seems like I can use dojo to do it. But when I display the page, I get a "dojo is undefined" error, and sure enough, firebug tells me it is not able to locate the dojo js files.

This is how I am doing it. Can you please point me towards what I am missing.

1. jsp page:
In the HEAD section: <s:head theme="ajax" />
In the BODY section:
<s atetimepicker name="deliveryDate" displayFormat="yyyy-MM-dd"/>

2. in web.xml:

3. I have struts2-core-2.0.12.jar in the build path, which seems to contain all the js files that the jsp looks for, but I dont know why they don't get read. In desperation, I tried extracting the jars into the path that firebug showed me eg: /MyProject/struts/ajax/dojo/dojo.js, but I was just getting other errors, and I gave it up because that didnt seem to be right solution anyways.

It seems so simple on the tutorial site, but I have spent an unbelievable amount of time trying to get it to work. Any and all help greatly appreciated. Thanks much.
15 years ago