• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts 1.x, 2, jstl questions

 
Ranch Hand
Posts: 2107
  • 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.
 
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 c:out 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: 2107
  • 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: 2107
  • 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: 2107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is Struts version 1.3.8.
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic