Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JSTL vs JSP Directives

Options
  • 31-10-2013 11:16am
    #1
    Registered Users Posts: 8,324 ✭✭✭


    I'm doing a college FYP, and it involves JSP pages. I've used them before with directives, but tutorials I'm following recommend using JSTL, which is fine, but I can't seem to find any articles saying why? The tutorial simply says it's better because you have no code exposure, but that's not going to be enough for my report!!


Comments

  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    JSTL 1.2 uses the same Unified Expression Language as JSP 2.1, so they're now completely compatible. when you add your code to JSP, you'll either include Java directly using <% .. %>, or using your own home-grown tags. JSTL is a set of standard tags that help you remove your dependency on plain Java and your own tags, and make your pages more readable because they look like HTML. Using JSTL makes even more sense if you're using JSF in your app, since buth systems use quite a bit of the EL.


  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    bpmurray wrote: »
    you'll either include Java directly using <% .. %>,

    There is never a good reason to use scriptlets


  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    ChRoMe wrote: »
    There is never a good reason to use scriptlets

    Wow! That is some enormous claim - please explain e.g. how you might surface the value of an HTTP-only cookie or system variable into a web page. While I agree that it's sub-optimal to have large swathes of embedded Java, at a guess I'd say that upwards of 99% of these contain simple values rather than functions, and that's a lot more efficient and cheaper to develop than a custom tag.


  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    bpmurray wrote: »
    Wow! That is some enormous claim - please explain e.g. how you might surface the value of an HTTP-only cookie or system variable into a web page. While I agree that it's sub-optimal to have large swathes of embedded Java, at a guess I'd say that upwards of 99% of these contain simple values rather than functions, and that's a lot more efficient and cheaper to develop than a custom tag.

    MVC used properly does away with the requirement and handles all the cases you list.


  • Registered Users Posts: 8,324 ✭✭✭chrislad


    ChRoMe wrote: »
    MVC used properly does away with the requirement and handles all the cases you list.

    That's the plan, anyways, as I'm using Spring MVC Framework for the site.


  • Advertisement
  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    chrislad wrote: »
    That's the plan, anyways, as I'm using Spring MVC Framework for the site.

    Excellent choice :)


Advertisement