This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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??
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> ??
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?
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?
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).