John Smith

Ranch Hand
+ Follow
since Sep 02, 2004
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 John Smith

if you just do a bean:write inside your script tags you'll get the value of the variable as those tags are parsed before the page is loaded thus before the javascript can ever possibly be executed
19 years ago

Originally posted by Ko Ko Naing:
What if we just check the value inside the textfield, using client-side Javascript? It is lightning fast and we can let the script focus to that textfield right after checking the value.



Yeah I'd do that, if you can't get things to work the way they should javascript will fix it
19 years ago
Umm yeah I presume it's session scope, I'm using the form-bean mapping in the struts-config.xml ... I don't think it creates a new form because I printed the class instance.toString() in the Action's execute method and it stays at the same memory address. Usually the forms keep values unless I clear them with the xml mapping method but this one is the opposite for some reason
19 years ago
I'm not sure what you're trying to acheive and why you're doing that. If you put the values on the request you're not actually submitting the form and don't need an ActionForm class at all, you can put those values there dynamicaly with javascript from any normal text input field. So unless i've mis-understood what you're saying here you either don't need a form at all or you should have 2 hidden submit buttons (not links) that don't have request parameters which will submit to your dispatch action path. The whole idea of a dispatch action is to not have 2 action paths so having that setup the way you do with seperate forms isn't the right way to go about it.

I would make an action mapping to submit your form to which will internally select whichever method and redirect from there to whichever action you want to invoke. The idea of a dispath action is not to call two different actions but to call one action which will internally execute the approriate method as you have set up in the java class
19 years ago
Have you given the hidden submit buttons an id each and tried document.getElementById('button_id').click() to ensure you're submitting the correct button?
19 years ago
I'm having trouble with an ActionForm of mine losing the values I set in it. The form page has some drop-downs whose options are generated from bean lists set in pop-ups, I need to be able to refresh the page and have the form retain it's values as set in the other fields. I've put redirect="false" in all action mapping and put empty reset methods in the relevant form classes and it still doesn't work, any bright ideas?
19 years ago
Try doing a bean efine on that bean or a tiles:useAttribute before you use it in your options tag
[ December 13, 2004: Message edited by: John Smith ]
19 years ago
Parse the table to output a comma delimited list name.csv, when excel saves it back to that file it will be in the correct excel format.

if you're doing it through struts you can have it as a link pointing to an action containing the following:



This will create a file with your data and send it to the browser which will automatically deal with it by popping up a download box or displaying if the client has an excel plug-in installed, hope this is what you were after
19 years ago
Instead of your dynamic cast use a bean efine on the variable exposed by the iterate tag, your bean:write tags will then be able to find the getter methods and such
19 years ago
Yeah, I don't think it works under struts anyway and rightly so. You should never nest forms.

Struts also doesn't do pop-ups so what you can do is dump a bean on the session with the data from you "inner form" if you need to
[ December 09, 2004: Message edited by: John Smith ]
19 years ago
I think you need to send your stuff seperately, you can have a dynamic link point to an url to grab your file and transport the other stuff in the normal way.
19 years ago
As far as I know that method doesn't work with a list as struts needs to know the type of bean in the list in order to find the getter methods. If you change your data to being stored in arrays then you just do a bean efine before your select box on the array ensuring you set the type attribute of the tag to be your array type eg. com.myCompany.myBean [], the id of this define tag goes into your collection field and you can now access the properties.
[ December 07, 2004: Message edited by: John Smith ]
19 years ago
1. If I'm understanding you correctly no you don't need a new instance, dynamicly cast the form in your execute method and you're set

2. The form is automatically put on the request if you use the <form-bean> mapping in the struts config, the name of the form in this mapping is the name of the bean on the request and you can access it's properties like any other bean.
19 years ago
I've done that and had it work, what you need to do is assign a String [] to your second select box (the one you're trying to get the data from) and replace the submit button with a standard html:button with an onclick event. The onclick event should iterate through the select box entries in javascript and set them all to selected then do your forms[0].submit.click();

Struts doesn't update the array used in your html ptions tags so if it was null before you'll still get null when trying to access the data afterwards. You might like to use an event handler to catch the enter key press and ignore it on that page too so the hidden submit button it only accessable by you through your javascript.

Hope this helps, let me know if you didn't understand any of it
19 years ago
Put a String array of the parameters on your request and use a logic:iterate loop to iterate through them. I find the html:link tag is mostly just convenient as you can acheive the same target protability by using a html:rewrite into a normal link ...



Not the cleanest solution but it's reliable, hope this is what you were after
19 years ago