wood burning stoves 2.0*
The moose likes Struts and the fly likes why cant we use normal html tags instead of struts html when using struts framework? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "why cant we use normal html tags instead of struts html when using struts framework?" Watch "why cant we use normal html tags instead of struts html when using struts framework?" New topic
Author

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

Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
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

Joined: Aug 03, 2008
Posts: 9307
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
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

Joined: Sep 01, 2010
Posts: 14
waiting for some replies..
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
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

Joined: Jan 10, 2002
Posts: 61451
    
  67

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
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

Joined: Jan 10, 2002
Posts: 61451
    
  67

For that you'd need to consult the documentation for the framework. Each tag serves a specific purpose.

 
Consider Paul's rocket mass heater.
 
subject: why cant we use normal html tags instead of struts html when using struts framework?