Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Question About servlet and HTML

  1. #1
    Member
    Join Date
    Nov 2010
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Question About servlet and HTML

    Hello.

    I'm currently creating a web app and I'm just wondering if somebody could clear this up for me.

    Alot of people on here and the web say not to create a html file from a servlet. is there any reason for this?

    I have a login page which validates by checking a database and loading a servlet showing the current tables in the database. this is all done through servlet and now im wondering if theres any security or performance issues, or whether this is just personal preferance.

    Thanks
    Kurt


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,307
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: Question About servlet and HTML

    Alot of people on here and the web say not to create a html file from a servlet. is there any reason for this?
    Never heard of this....if not a servlet then what is the alternative? jsp? For what its worth, jsp is a servlet, but different in the sense that it allows a programmer to 'exit scripting mode' to write pure html, making quick html easier relative to having to println everything.

  3. #3
    Member
    Join Date
    Nov 2010
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Question About servlet and HTML

    Yeah a jsp.

    I did look into writing this in jsp as, like you said, its the same more or less.
    As im pulling alot of information from database tables, I thought that a servlet would be better for me because im using the "rs.next()" method alot.

    Another question whilst its on the brain. I have a Java Application aside from the Web App.
    How can I call the App from a button or other method within the Web App

    Thanks for clearing that up for me.
    Kurt

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,307
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: Question About servlet and HTML

    Thanks for clearing that up for me.
    Remember, just one person's opinion...your mileage may vary.

    I thought that a servlet would be better for me because im using the "rs.next()" method alot
    To account for changes as well as code reuse in client, server, and database you may consider doing this server side, in essence following an MVC type of architecture. If you have business logic client side, making changes and re-using logic down the line become more and more difficult as the application grows and the logic get more ingrained in the client (placing logic server side decouples these so changes and code reuse are much easier)

    Another question whilst its on the brain. I have a Java Application aside from the Web App.
    How can I call the App from a button or other method within the Web App
    If I understand the question correctly, this is where having logic on the server that I mentioned above helps because it can be re-used by one or more clients.

  5. #5
    Member
    Join Date
    Nov 2010
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Question About servlet and HTML

    I did have this in mind to start with but not sure how to go about this.

    Having a html template which is the view, The controller would be the Servlet and the model is the database.
    Am i correct on that?

    starting with a login page which querys a database and checks if the username and password are corrent(not secure i know but i need this system up and running soon so i can sort that out later)
    once the servlet has checked the login this redirects to a servlet created form which is populated
    from the databse.

    how do i create a html template in which the form can be populated from the servlet.

    Am I on the same track. If not, do you know of any web site i can read up on about going about this?

    thanks again
    Kurt

  6. #6

    Default Re: Question About servlet and HTML

    Sorry to say i can not understand what you are saying. Use out.println for using html tags.

Similar Threads

  1. Servlet Threads Question
    By doNotPost in forum Threads
    Replies: 1
    Last Post: October 21st, 2010, 09:19 AM
  2. Trigger Button in Html
    By liron in forum Java Networking
    Replies: 1
    Last Post: October 16th, 2010, 09:17 AM
  3. please solve this question on html:multibox?
    By tejz in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: February 13th, 2010, 02:18 AM
  4. Help with html tags in java
    By peliukasss in forum Member Introductions
    Replies: 0
    Last Post: February 2nd, 2010, 05:47 AM
  5. Concatenating string with html tag
    By subhvi in forum Java Theory & Questions
    Replies: 4
    Last Post: September 29th, 2009, 05:47 AM