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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

connecting to a database directly through your jsp page

  • 27-01-2006 10:54pm
    #1
    Posts: 0


    hi.

    Is it better to connect directly to a database via a jsp page or would it be better to implement servlets and java classes in-between. at the moment i am trying to create a registration form in jsp for a site i am working on. I have created
    1. a 'User' class file to accomodate the user been registered
    2. a data source file to connect to the database
    3. a java interface which has an insert new user method in it
    4. a record new user file which has the 'insert' statement in it

    basically i am wondering would it be better to link it to a registration page via a servlet or just skip all that and connect directly fro the 'registration.jsp' page


Comments

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


    Is this a single-page app? Is it going to be enhanced in the future? If so, using beans to get at your data is probably a good way to go.

    On the other hand, if it's simple and an independent page, you could use the JSTL sql tags, or even put some JDBC code directly into your page.

    Remember that a JSP *is* a servlet, although it's HTML with Java mixed in, while a traditional servlet is Java which spits out markup, so doing this in a servlet isn't really doing anything different.

    Have you considered using the various frameworks: JSF provides a pretty good way to link backend data with the UI.


  • Posts: 0 [Deleted User]


    bpmurray wrote:
    Is this a single-page app? Is it going to be enhanced in the future? If so, using beans to get at your data is probably a good way to go.

    On the other hand, if it's simple and an independent page, you could use the JSTL sql tags, or even put some JDBC code directly into your page.

    Remember that a JSP *is* a servlet, although it's HTML with Java mixed in, while a traditional servlet is Java which spits out markup, so doing this in a servlet isn't really doing anything different.

    Have you considered using the various frameworks: JSF provides a pretty good way to link backend data with the UI.

    hi sorry for the tardy reply. i just connected from a servlet in my source package in the end. Was aiming to use a DAO pattern. its a relatively small application so i just couldnt be ars*d creating class after class.

    doing a project where i have to create a fantasy football website. its for my 3rd year in college.

    wish me luck, im gonna need it


Advertisement