A knibbs

Ranch Hand
+ Follow
since Aug 23, 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 A knibbs

Originally posted by Brent Sterling:
Right...you need to set the values to false in your reset method...if you are using session scope. When using request scope then a brand new instance of your form is created and the value is set to whatever you do in your constructor (or the declaration of the property). The scope is set by the scope attribute on your action mapping. The default scope is session (though that can be changed).

- Brent


I am using request scope (the value set in struts config for the action I have scope="request") so unless I am way off that is request scope. I suspect most of my confusion is due to the fact that I am not working with the property directly as it is in a list. I am going to attempt to test a few more things.

thanks again for the help.
16 years ago
So my issue seems to fall down to the fact that I don't have anything in the reset of the bean form. It seems the only way to go about recognizing that a value has been reset is if you first set them all to false. Does that make sense ? I am going based on the docs of the checkbox in struts.

thanks again.
16 years ago
(Firstly please let me know if I am using any terms incorrectly, as I often find that I seem to use terms that aren't the generally accepted terms and I am trying to learn all I can ). The scope is request. I am setting the values of the fields each time the page is requested. I know it's something simple that I am missing, as you helped me with a similiar issue in the past. I now have the form to the point where it will start out as false, will allow me to set it to true submit the page and retain that information, but subsequently attempting to set the checkbox back to false does not work. As there is minimal amounts of data involved in this case, I suspect a hidden checkbox would be sufficient. Is it simply a matter of putting a checkbox with the same info only putting hidden instead of checkbox in the tags ?

I have continued to play with the application and discovered something.
Submitting the form several times with the value of false and the form remains false. Submitting one true and then either true or false afterwards always remains true. For this reason I suspect it's an issue with resetting the value of the checkbox upon completion. Is there any quirks with regards to checkboxes ? In the value field should I be putting in something like bean:write individual value of checkbox - or is leaving it blank sufficient ?

thanks as always.
16 years ago
I think I am working through it now, the issue that is causing me particular grief is working with checkboxes. I will put an update in here when I make some more headway, or if I run into another issue. Again thanks for the help.
16 years ago
I am certain it is me missing something blatently obvious, but can anyone offer me any ideas as to why my form won't hold the values after I submit the page ? I have a page where I search for users, the page is then given back a list. I want to be able to modify the users permissions and then submit the page and have the changes take effect, but when I submit the page there is nothing for the action to work on - the data seems to have been lost along the way.

Any thoughts ?
16 years ago

Originally posted by Merrill Higginson:
I'm not 100 percent sure, and I don't have time to test it right now, but...

I believe it's as simple as:

Assuming defaultLocations is either a List or Array of Strings, the above will display the first element of the list or array.

If your goal is to format the list so that it can be put in a JavaScript fucntion, another possibility would be to add a getter to your ActionForm with a name something like getFormattedDefaultLocations that would return a string something like this:

Then you could simply use the expression


[ October 16, 2007: Message edited by: Merrill Higginson ]



Actually I was trying to determine which of the items was selected. In the end I ended up using something along the lines of :

document.formName.optionsName.selectedIndex

and it worked exactly as I needed it to.
Thank you so much for all the assistance you gave me.
16 years ago
Unfortunately I am still fighting with this one - anyone have any ideas as to how I can pull out the selected index to pass into the javascript so I can pull out and set all the necessary info from the string ?


thanks in advance.
16 years ago
Thanks for all the help to this point. I have (hopefully ) one last question.
How do I pull out the selected value from it and not the entire list ?

I am trying to do something like :


Unfortunately I get the entire arrayList, not just the value that is selected - any thoughts or ideas ?
16 years ago
Thanks for the information Merrill. As I said unfortunately I am using the
2.3 Servlet specification. Perhaps this is a situation where I am trying to fit a round peg in a smaller round hole.
Basically what I am trying to do is set up a page asking for delivery information. There are a couple of default address that can be used. If they select a default address I want to change all the fields via javascript on the page to match said information. The default names are what is in the dropdown. Once one of them is selected on change fires a javascript function that will take in the string of all the addresses in a comma seperated form, pull out the values and then assign them to their specific address, at this point I am simply trying to add the string assuming that it should be trivial to add the selected value to the list as well - hopefully that is the case.

Does this make sense with what I am attempting ?

Also I didn't realize that the file would be in the contrib/struts-el/lib and for some reason didn't look in there.

Brent - I was missing the tld's, for some reason I just copied over the jar file and completely forgot to include the tld's, so now I have the tld's for struts-html-el, struts-bean-el, and struts-logic-el

Now when I try to run the program I don't get any errors, but my drop down menu is no longer visible either. Any further thoughts ?

*Edit*
I'm an idiot, I had a typo in my tag definition which is why it wasn't being picked up.
Thanks so much.


I currently have the following:


defLocals is a list of the defalt location names, where as defaultLocations is the comma seperated string.

As always I appreciate any help that you have offered up to this point.
[ October 12, 2007: Message edited by: A knibbs ]
16 years ago
Thanks for the suggestions Merrill and for those wondering where to find struts-el.jar it is available here:
http://people.apache.org/repo/m1-ibiblio-rsync-repository/struts/jars/
apparently there was an issue with it not being loaded in some versions of struts.

I tried what you suggest and unfortunately it started by saying that :
"Options tag must be nestedin a Select tag"

So I was hoping it would be as simple as adding -el to the end of the select tag, but apparently it no longer shows the drop down at all. I am guessing it is because the info that was in the select tag also has to use el expressions, in which case I think it's time for me to read.
16 years ago
Thanks for the post.

Unforuntately I am using the 2.3 specification. For those who need info on where to find info on el I went here:
http://struts.apache.org/1.x/struts-el/index.html

The part I am confused about and would love any assitance anyone can suggest is how to substitute in the information.

I tried the following:

only to be met by:
Unterminated <html:select tag. Can anyone shed some light on my problem ?

thanks in advance.

[ October 10, 2007: Message edited by: A knibbs ]
[ October 10, 2007: Message edited by: A knibbs ]
16 years ago
Hi all I am trying to get a value from struts into a javascript function. Basically I am trying to achieve the following:
I am trying to get a string (that holds a dozen addresses in a comma separated list ) from a sting stored in an object into the javascript function. I want to be able to then parse the pieces of the address out of the string and set parts of a form with them, my issue is I can't seem to figure out how to put the string into the javascript part - I tried the following:



This was based on a hacking some items I found in a forum, but essentially all I need is
putting the string from <bean:write name="User" property="defaultLocations"
into the javascript function to be able to parse it.

Any suggestions or thoughts would be greatly appreciated.

thanks
16 years ago
Thanks for all the wisdom you have shared Bear. I appreciate it.
Thanks for the warning, but the way I look at it is as follows. The only manner in which to get to this page is to have logged in and be an authorized user, so weather they would see it in the source or in the app itself is pretty much the same result. (Nice to see that someone has concern over privacy of data and ensuring that only those who require information are given it. Seems like far to many people are selling their information short for no particular reason).
The most it would be is a dozen addresses. Does this seem like too much information to store in javascript concepts ?

Thanks for all the help so far Bear.