Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 1.x, 2, jstl questions

 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

While converting a struts 2 application to struts 1.x, I encountered the following questions on my mind. Any one know the answer?

1. In struts 2, the label can automatically have '*' for 'required' fields. Is there such in struts 1.x?

2. My validation, in struts 1.x, using 'double' and 'doubleRange' doesnt work. Any reason it wouldnt work? I have given the correct attributes. The jsp also has the javascript struts tag, and attributes on the 'form' tag for the validation.

3. My login page struts 1.x password field ideally is masked, i.e. an asterisk is shown while typing the password. Is it possible in struts 1?

4. is jstl/el useable in struts 2, just like it is in struts 1.x?

5. is there any issues in jstl tags inside struts tags, and struts tags inside jstl tags, for both struts 1.x and 2?

Hoping for your ideas.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesus Angeles:
1. In struts 2, the label can automatically have '*' for 'required' fields. Is there such in struts 1.x?

No, Struts 1 will not do this.
Originally posted by Jesus Angeles:
2. My validation, in struts 1.x, using 'double' and 'doubleRange' doesnt work. Any reason it wouldnt work? I have given the correct attributes. The jsp also has the javascript struts tag, and attributes on the 'form' tag for the validation.

I don't know what the problem is here. If you need help debuggin it, post your code.
Originally posted by Jesus Angeles:
3. My login page struts 1.x password field ideally is masked, i.e. an asterisk is shown while typing the password. Is it possible in struts 1?

Just use the html:password tag.

Originally posted by Jesus Angeles:
4. is jstl/el useable in struts 2, just like it is in struts 1.x?

Yes, it is. Remember that Since Struts 2 must run in a Servlet 2.4 container, EL expressions can be placed anywhere in the JSP without a cut tag.

Originally posted by Jesus Angeles:
5. is there any issues in jstl tags inside struts tags, and struts tags inside jstl tags, for both struts 1.x and 2?

None that I'm aware of as long as you're using Struts 1.3. One issue with earlier versions is that you couldn't use indexed="true" inside a JSTL c:forEach loop. That's fixed in 1.3, though.
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesus Angeles:


2. My validation, in struts 1.x, using 'double' and 'doubleRange' doesnt work. Any reason it wouldnt work? I have given the correct attributes. The jsp also has the javascript struts tag, and attributes on the 'form' tag for the validation.


Hi,

Below are my codes.

Xml




validation xml



Jsp





The validation for the double and doubleRange is not working.
[ June 12, 2008: Message edited by: Jesus Angeles ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of Struts are you using? Does the validation work for other fields on the same page? Does the "required" validation on this field work? When you say it doesn't work, what do you mean? That it just accepts invalid values without complaining?
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With that code above, the 'required' is working. A pop up appears when the 'price' is empty.

If I put a valid value like '5', it is processed correctly.

However, if I put an invalid value like 'xx', it doesnt complain. Zero is saved in to mysql (via ejb entity bean persistence).
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't answer my question about which version of Struts you're using. The reason I asked it is that your validation code looks like it should work for Struts 1.3 but may not for previous versions. If you're using a previous version, consult the documentation for the version you're using.
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is Struts version 1.3.8.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic