Results 1 to 6 of 6

Thread: Call another jsp page

  1. #1
    Join Date
    Dec 2009
    Posts
    292

    Call another jsp page

    Hello
    I am a beginner in this field. I created a JSP with NetBeans with buttons and want to know how to click on a button, call another JSP page. I have tried it, but I am not getting the desired output, so can you guys please help me. An example will be appreciated. Thank you.
    Last edited by Miles Runner; 12-01-2010 at 09:09 AM.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,010

    Re: Call another jsp page

    Hi,
    I am a beginner in this field. I created a JSP with NetBeans with buttons and want to know how to click on a button, call another JSP page. I have tried it, but I am not getting the desired output, so can you guys please help me.
    If I am not wrong in javascript it takes a line to do this job, just see the below code line and try it
    Code:
    onclick ="document.location.href = 'test.jsp'
    Hope you understand it and start creating your new program.

  3. #3
    Join Date
    Dec 2009
    Posts
    292

    Re: Call another jsp page

    Hello
    If I am not wrong in javascript it takes a line to do this job, just see the below code line and try it
    onclick ="document.location.href = 'test.jsp'
    It works my friend. Thank you a lot. I will now try from this page, to call a servlet. I have not called a servlet from an jsp page before, hope this works for me. Though, i do not think this is going to be much difficult to do it. I'll keep you posted if I do have a problem in doing that.

  4. #4
    Join Date
    Dec 2009
    Posts
    202

    Re: Call another jsp page

    Hey guys
    Even i have an similar kind of a problem. I'll explain what I do to develop a web application:
    1) I created an index.jsp page with buttons for the main menu of my application.
    2) From this interface and clicking a button, it should redirect me to another jsp page which also contains buttons CRUD (add, edit and delete).
    3) By clicking for example on the Add button, I redirect to a servlet which should normally contain text fields for entering information.
    4) By clicking on the Send button, there must access the DB to record in the table (I have DAO classes to handle CRUD operations).
    Is what I am in the right direction?. Call the servlet is the same principle that since it is a JSP file in Java. Help me please.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,394

    Re: Call another jsp page

    Hi
    " 1) I created an index.jsp page with buttons for the main menu of my application.
    2) From this interface and clicking a button, it should redirect me to another jsp page which also contains buttons CRUD (add, edit and delete).
    3) By clicking for example on the Add button, I redirect to a servlet which should normally contain text fields for entering information. "
    I think we should apply the concept of MVC (model, view = jsp in your case, control), ie displaying jsp must be controlled, too, this is not the servlet that s 'but displays the jsp.

  6. #6
    Join Date
    May 2008
    Posts
    2,393

    Re: Call another jsp page

    Hi
    Totally agree, if you want your web application more organized you should apply the MVC pattern, this way you will be less lost between all the different files. For example entering your form should be in a jsp page that it returns the results to a servlet that performs the desired processing and returns the results to a JSP page for display.

Similar Threads

  1. Firefox 15 page loading is very slow when opening modem page
    By Thomas Hewitt in forum Technology & Internet
    Replies: 2
    Last Post: 10-09-2012, 10:48 AM
  2. Replies: 14
    Last Post: 09-04-2012, 02:49 PM
  3. Replies: 10
    Last Post: 03-12-2011, 09:31 AM
  4. Replies: 6
    Last Post: 12-09-2011, 10:47 PM
  5. Replies: 9
    Last Post: 26-08-2011, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •