This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp in Struts

 
Venkatesh Kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi :

I would like to know if a jsp page to be used in struts framework should always be developed using struts custom tags.Cant we use the normal jsp pages ??

Thanks
Venkatesh
 
Kim Lilienfeld
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I don't know the "correct" answer to that question so this is only my opinion...

I found the great thing about struts is that it reduced the complexity of jsps especially when it came to retrieving information from and displaying information on a web page. I find the simplicity of it beautiful (ok, I'm a geek)!

Lets look at a textfield in a jsp.. Using the struts tags you would code the following:
<html:text property="formVariable" size="15"/>

If you wanted to display a value, its a simple case of in your action typing
aForm.setFormVariable("My Value");
And Voila! "My Value" is displayed in the textfield... and if someone enters a value then in you simply need to type (in ur action):
String theEnteredValue = aForm.getFormVariable();

How simple is that!!! Ok, so you do need to do some extra things like add the form and action to the struts-config, specify what is associated with a particular jsp and ensuring all your variables are in your form class - but personally, it just makes my life a whole lot easier which means I get extra time to surf the net at the end of the day

And its especially great when you initialise your form with a Value Object or export a Value object from your form so that you don't have to initialise each variable in the object!

Ok, thats my 2 cents!
K
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, AFAIK it is not mandatory to develop your JSPs using Struts though you would be not utilizing it 100% .You can as well use normal JSP tags with Struts framework.
Any Comments ??

Thanks,
Priya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic