Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why cant we use normal html tags instead of struts html when using struts framework?

 
Harishwar Madhya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a small doubt.. In interviews too they have been asked this question many times.. Could you please tell me "why cant we just use normal html tags instead of struts tags while using Struts framework??" what makes the difference of struts html and normal html tags??

waiting for quick reply...

Harishwar
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use normal HTML tags like <input type="text" /> in JSP pages when you use Struts. If you use the struts tags, you get certain advantages like validation messages, automatic form fill-up etc...
 
Harishwar Madhya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:You can use normal HTML tags like <input type="text" /> in JSP pages when you use Struts. If you use the struts tags, you get certain advantages like validation messages, automatic form fill-up etc...


Thnx Ankit for replying me.. Yeah I agree with your answer.. but i have a small doubt.. whats the diffference between <form> and <html:form> ?? why cant we just use <form> instead of <html:form>? and why cant we use normally <input type="text"> instead of using <html:text> ??


waiting for quick reply..



Harishwar
 
Harishwar Madhya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
waiting for some replies..
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harishwar,

Did you get your answer to this question?
If no, can anyone please explain this? I know struts html tags automatically populates html fields from form beans, but we can do the same thing using scriptlets, can't we? Is there anything else that these tags do? for eg., if I use normal html, will the framework still make the user input values available in the form bean?
If I do not use these tags, will the framework still work normally and correctly without me having to do any extra work?

Thanks in advance to all for your help

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scriptlets should never be used in any JSP page. It's 2013 -- over 12 years (12 years!) after scriptlets were obsoleted by the JSTL and EL.

In any case, using the custom tags provided by the framework to do the work you are thinking of doing yourself with scriptlets (or even with more modern techniques) is the whole point of using a framework. If you don't want that, why would you be using the framework in the first place?
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear...thanks for the quick reply. I get the point you are making. But can you please elaborate on which type of work the struts HTML tags do in the back end? As the original poster noted, this sometimes gets asked in the interviews. To what extent exactly will I be losing out on the framework's advantages if I use normal html.
Please provide specific technical functions, if possible (or re-direct to a good source that I can read up).
Thanks again...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For that you'd need to consult the documentation for the framework. Each tag serves a specific purpose.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic