Mario Romero

Greenhorn
+ Follow
since Aug 06, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mario Romero

Thanks herman! I forgot the usefulness of java inheritance
17 years ago
It�s there some way to make a global Action which is called everytime another action is called (like an intermediate Action)

I want to check if a Session is present but I dont want to change every Action in every module to put the same code.
17 years ago
...It didn�t work. How can I submit the Arraylist then?

This is a trimmed down version of my JSP:


Sorry about the mess, I�m still learning and merging a lot of things at once.
17 years ago
mmm thanks Christian, that should made the trick for now.


Hari, to your first question, yes. You can do MyForm.setField(whatever) in the Action, and the form will "transport" the values to the next JSP page which you can show with c:out for example.

2� question, an attribute doesn�t pass through the Form, it goes directly in the request to the JSP. There you can show it with c:out too.
[ August 24, 2007: Message edited by: Mario Romero ]
17 years ago
In fact, I�m not sending the ArrayList, and dont want to do it.

From pages I found I though that Form values are maintained through JSP�s without the need of repopulating the Form again, but the ArrayList and all of the multiple fields I have in the form are reseted, or the form is created again for each request.

Is there a way to keep the data in a structs-way without resorting to public variables or whatever?

Thanks to another member I found this:
<bean:define id="name" name="MyForm" property="MyFormField" type="java.util.Collection" />

I have to try that yet, but it makes sense that since MyFormField is in the jsp, the form will take the value in the request.
I find it cumbersome and not very efficient but this monday I have to finish this so...
17 years ago
Is there a way I can retrieve the values of a Form in a 2� Action which I set on the 1� Action?

This is my scenario:

Struts-config


1� Action


the Form


The JSP takes the Form values of "listaNoticias" correctly, and submits to another action:

2� Action


And that didn�t work because the form values are lost. Why?

I tried making the scope as session in the struts-config action-path but didn�t work.
17 years ago
That tests are mostly useless anyway. Just 20 / 40 simbols questions and that will told your intelligence...
Like the test from female magazines "Do you know how to flirt?" Whatever you choose you�ll have a not bad to great result... uuh no... I never took that test, what makes you think that?
17 years ago
The problem is that I have an ActionForm for each JSP (in this case at least) to make it more "modularized" instead of relaying in a big ActionForm.

I found this wiki http://wiki.apache.org/struts/StrutsMultipleActionForms which talks about the problem and some solutions. I will just make a bigger ActionForm then and bookmark that page for later use when I find myself more confortable with struts.

Btw what I did was just creating a new ActionForm

And think that the next page will magically take that form since it was the same class it wanted. Forgetting all the OOP basics is my speciality.

Thanks again Merrill.
[ August 24, 2007: Message edited by: Mario Romero ]
17 years ago
Wenas, I have an Action that set the fields of an ActionForm directly, like this:



The ActionForm method looks like this:



After that I checked that the form fields where correctly set.
I expected that in the JSP forwarded, the fields would auto populate with the ActionForm values since names are the same:



...but no, fields are empty. What could be the problem?

Thanks
17 years ago
Sorry I was on vacation and I couldn�t reply.
I think I�m getting struts... slowly Thanks again
17 years ago
Great help as always Merrill. Thanks.

But I�m wondering, how can I "inyect" a value coming from the Action in a struts tag?
17 years ago
I know it�s not logic, but that�s what I�m doing and works.
Perhaps something barely related with this is not right in some part of my code, but for the record, this is what I have actually:

17 years ago
I�m having a problem with sintaxis when inserting a bean into a struts tag.
This is a sample:

elemento is an user bean that I�m iterating.
This renders in the html source code this:

Note that after Crear Rol it fails to write the > end tag too.
How can I fix it?

Thanks
[ August 09, 2007: Message edited by: Mario Romero ]
17 years ago
..strange, the problem was with the array of "rol" in the ActionForm.

Whenever the select has multiple=true or not, rol must be an array or it won�t get the value, so I have to use rol[0] later.
Looks like I did something wrong but I checked the form getters and setters and I dont see anything bad.
At least is working, thanks again.
17 years ago
Thanks a lot! That worked. I though "multiple" referred to select more than one at the same time. Presupposing is one of the worst error one can�t debug.
17 years ago