Include a jsp file in the same page by click on a button

Hello Everybody
I'd like to control "my.jsp" page by clicking on some buttons. So if I click on Button1, f1.jsp go to be includeing in "my.jsp" or Button2 to include f2.jsp on "my.jsp" and so on
Thank you in addvance

In my.jsp you could put a form with n submit buttons whith different values of parameter "name", like this:
---My.jsp------
<form method="yourMethod" action="My.jsp">
<input type="submit" value="Button1" name="button1">
<input type="submit" value="Button1" name="button2">
<input type="submit" value="Buttonn" name="buttonn">
</form>
<%if(request.getParameter("button1")!=null){%>
<jsp:include page="f1.jsp">
<%}%>
<%if(request.getParameter("button2")!=null){%>
<jsp:include page="f2.jsp">
<%}%>
<%if(request.getParameter("buttonn")!=null){%>
<jsp:include page="fn.jsp">
<%}%>
I didn't try it but it might work.

Similar Messages

  • How appears a  new JSP  file  in the same page?

    Hello all,
    I have a JSP file in a portal page.From this file I want to open another one.The new file must be opened in the same portal page with the same size and exactly in the same place. But it always openes a completely new page and the portal page disappears.I know that the mistake is from the provider file, but I don't know what should I change.
    Thanks for your help!
    K.Chrostani

    In my.jsp you could put a form with n submit buttons whith different values of parameter "name", like this:
    ---My.jsp------
    <form method="yourMethod" action="My.jsp">
    <input type="submit" value="Button1" name="button1">
    <input type="submit" value="Button1" name="button2">
    <input type="submit" value="Buttonn" name="buttonn">
    </form>
    <%if(request.getParameter("button1")!=null){%>
    <jsp:include page="f1.jsp">
    <%}%>
    <%if(request.getParameter("button2")!=null){%>
    <jsp:include page="f2.jsp">
    <%}%>
    <%if(request.getParameter("buttonn")!=null){%>
    <jsp:include page="fn.jsp">
    <%}%>
    I didn't try it but it might work.

  • How to create links to different files on the same page?

    Good day to all again,
    can someone please guide me through creating several links to different files on the same page. In other words, I am creating a photo page where my links are called Gallery 1, Gallery 2, etc... I would like to create links so when the User clicks on Gallery 1, they see Gallery 1 slide show in the frame; when the user then clicks Gallery 2, then they see Gallery 2 slide show in the window.
    My slide show files are done and I am using GoLive CS2. I have no knowledge of JavaScript or ActionScript/Flash.
    Any suggestions are highly appreciated.
    Thank you
    Alek

    Hi Diana,
    I'm a professional photographer and in the process of getting
    my finished site published. I used Coffeecup Photo Gallery. You can
    create multiple albums on the same page. Do a Google search for the
    address. It's easy, inexpensive, and it works. I tried to do this
    with the Photo Gallery in DW and FireWorks--but couldn't get it
    right. CC uses Flash and Javascript.
    Good Luck

  • How to display the JSP output in the same page....

    im new to JSP..... can anyone tell me how to display the output of a particular JSP page in the same page itself...... if anyone could send a small sample code it will be very useful for me....
    thanks in advance
    regds
    Krish......

    Hi Robert -
    When you say you are writing a template-based Renderer, do you mean that you are creating a custom look and feel and replacing the header Renderer? If so, I'd recommend instead simply creating your own template (not template-based Renderer), and reference your template directly from your uiXML pages where you want to insert the timestamp.
    You'll probably want to write a method data provider which calls System.currentTime(), convert the result to a date, and then use Java's date formatting capabilities (see java.text.format.DateFormat) to produce a user presentable String that you can return from your data provider.
    For more info (and samples) on templates and data binding, see the "Templates and Data Binding" section of the "Includes and Templating in ADF UIX" help topic:
    http://tinyurl.com/5b7bf
    Andy

  • Accessing form field on a page with JSP code on the SAME page

    Hello people,
    This is what i want to do...
    I need a profile form for my project wherein the user can update his profile.
    it has a username field. I want the username to be changeable at any point of time.
    if the user wishes to change his username he simply goes to the Change_Profile page (the one im talking about) and changes it.
    But the username should not conflict with the username that any other member might have already chosen
    so i put a button on the form right below the field "username" for the user to check for the username's availability.
    I want the following things to happen when the user types a username and clicks on this button (which is not a submit button)
    1. I want to access my MS SQL 2000 server database and check for all usernames accepted by that form
    2. I want to compare each with this username
    3. I want to show the result to the user on the very same page+*. that is "Username available" or "Username Taken"
    4. I want to show the result using an alert message from javascript+*
    help me if u can please.

    1. Don't do SELECT * FROM users for fun unless you want to list them all to the client.
    2. Use a WHERE clause in your query and just check if it returns zero rows or not.
    3. Let the servlet with the business logic forward the request to the same page using RequestDispatcher.
    4. Let the JSP print the Javascript code to the response based on a condition.

  • Cfile - uploading 2 files on the same page

    Hi,
    Can anyone tell how to do this?
    I have 2 file upload fields on the same page
    <input name="FileContentsdec" type="file">
    <input name="FileContents" type="file">
    When I submit the page i use this code:
    <CFif isdefined("form.filecontents") and
    len(form.filecontents) gt 0>
    <cfoutput>
    <cftry>
    <CFfile action="upload" filefield="FileContents"
    destination="D:\inetpub\wwwroot\jobapp\files"
    nameConflict="MakeUnique"
    accept="application/msword,application/pdf" >
    <CFset ClientFile = cffile.ServerFile>
    <cfcatch>
    <cflocation
    url="?linkid=jobapp&page=apply&jobid=#jobid#&Message=#URLEncodedFormat('File
    not uploaded - please select either a Word document or a PDF
    file')#">
    </cfcatch>
    </cftry>
    </cfoutput>
    </CFif>
    <!--- delcartion upload --->
    <CFif isdefined("form.FileContentsdec") and
    len(form.FileContentsdec) gt 0>
    <cfoutput>
    <cftry>
    <CFfile action="upload" filefield="FileContentsdec"
    destination="D:\inetpub\wwwroot\jobapp\files"
    nameConflict="MakeUnique"
    accept="application/msword,application/pdf" >
    <CFset FileContentsdec = cffile.ServerFile>
    <cfcatch>
    <cflocation
    url="?linkid=jobapp&page=apply&jobid=#jobid#&Message=#URLEncodedFormat('Declaration
    info not uploaded - please select either a Word document or a PDF
    file')#">
    </cfcatch>
    </cftry>
    </cfoutput>
    </CFif>
    I then insert the filemanes into a db using:
    <cfquery name="insert" datasource="#DataSource#" >
    INSERT INTO applications (aloginid, ajobref
    <cfif isdefined("ClientFile")>
    ,aotherinfo
    </cfif>, aOffender <cfif
    isdefined("filecontentsdec")>
    ,aOffenderinfo
    </cfif>
    ) VALUES (#listrest(GetAuthUser())#, #jobid#
    <cfif isdefined("ClientFile")>
    , '#ClientFile#'
    </cfif>, #offender# <cfif
    isdefined("filecontentsdec")>
    , '#filecontentsdec#'
    </cfif>
    </cfquery>
    The problem is, the same filenames are inserted into boith
    fields.
    Can anyone help?
    Thankyou

    i dont think there should be any specific reasons for this.
    coz it has worked out for me for upload of 4 files in a
    single page
    but still try the following:
    1. set the filename variables to null before assigning the
    serverfile name to it.
    2. try not to use the reserved words as variable
    names,Clientfile is a reserved word.

  • Including a jsp on the same page by clicking a button

    Hi,
    I have a jsp page where there are many controls and some buttons. If I click a buton called "Edit" I need to include a jsp page below the existing controls.
    Can someone please tell me how to do that?
    <tr>
    <td>
    <a><img name="View" src="view.gif" border="0"/></a>
    <a><img name="Edit" src="edit.gif" border="0"/></a>
    </td>
    </tr>
    this is thecode which I have for buttons in my page
    Thanks

    Using javascript, you could wrap the included page within a DIV tag or SPAN tag that is initially not visible. Then when the user clicks the button you would make the hidden DIV or SPAN visible.
    The visibility attribute can be set to visible (to see it) or hidden (to not see it). Here's a page that might shed some light:
    http://www.csctce.com/demos/dom_tutorial/
    HTH

  • How to go to a particular field of the same page by clicking the radio button.

    Hello All ,
               I am working on a form which is designed by some one else . There is a Page - 8 . And there is a question at the first which is in another subform.
               At the end there are several radio buttons . If some one is clicked as yes then the focus should be on Question which is present at the beginning of the form.
    My code goes like this .
    if(TopmostSubform.Sub_Form_Section.Page8.RadioButtonList[0].Q9_EnterAnotherProgramRegEntSt ate[0].this.rawValue ==true)
    xfa.host.setFocus(' TopmostSubform.Sub_Form_Section.Page8.Table.Row[1].Cell[1].Q9_ProgramNm');
    Form hierarchy for Q9 _ProgramNm is -- TopmostSubform.Sub_Form_Section.Page8.Table.Row[1].Cell[1].Q9_ProgramNm
    Form hierarchy for radio button is -- TopmostSubform.Sub_Form_Section.Page8.RadioButtonList[0].Q9_EnterAnotherProgramRegEntStat e[0]
    The event should be click event on JavaScript.
    Please someone help !!!!

    Hi
    In the second screen, for field empno, set the attribute Output only as X and set group1 for empname as 'INP'.
    In PBO of second screen, write this code.
    loop at screen.
    case screen-group1.
       when 'INP'.
         if sy-ucomm = 'DISP' .  "sy-ucomm value when you click display
           screen-input = '0'.
           modify screen.
       endif.
    endcase.
    endloop.
    regards
    Navneet
    Message was edited by:
            Navneet Saraogi

  • Close the IE page on click of a button in the transaction

    Hi All,
    I have a button on the transaction and once I click the button it should log off from the SAP WEB AS and close the Internet Explorer page.
    Can anyone guide me through the process?
    Thanks in advance,
    Sudhi

    from your earlier Passing data through URL i understand that you use integrated ITS, so my answer is going to be based on that.
    in your program add the following :
    include AVWRTCXM .
    and write the following code for button click.
    field-set '~OkCode' 1 '/NEX' .
    its-browser_redirect 'XXX'.
    now go to SICF
    navigate to your service under sap/bc/gui/sap/its/
    double click on the service
    choose error pages tab
    then choose logoff page tab
    make sure "explicit response time" radio button is selected.
    Click on the create icon next to "Body" in the resulting window enter the following text
    Thanks for using ITS
    <a href="#" anclick="windaw.clase();">
    click here to close this window
    </a>
    in this line (anclick="windaw.clase();) change the alphabet 'a' to 'o' .
    Save the service.
    and test the same.
    Regards
    Raja
    Message was edited by:
            Durairaj Athavan Raja

  • Redirecting to the Home Page when clicking on close button of the Item in a list

    Hi all,
    I have a SPD Workflow configured in a site to show a link to the current item view form from the autogenerated mail, so that when a user clicks on the link , it gets redirected to the list item as a Viewform.aspx. on closing t hat the user will be redirected
    to the list and shown the allitems.aspc view of the list. But the user now wants to redirect to the Home page of the site. I have created and deployed the SPD WF using Designer 2010 and deployed to the production. But Now I am fearing that to achieve
    this requirement do I need to change the entire approach of SPD Workflow? If anyone has pointers please share with me.
    Thanks,
    K.V.N.PAVAN

    No, I said to set the Source parameter of the URL to the home page.  You have to do this in order for the browser to know where to send the user upon closing or updating the item.  This is how all redirects work in SharePoint.  If you go browse
    around and click on an item, you will see a Source parameter in the address bar.  The URL that comes after "&Source=" is the URL your browser will be sent to after you click "close."  This is how SharePoint remembers the context of where you
    were.  If you don't provide a Source parameter, then it defaults to the list where the item lives.  That's what you're currently doing, so you need to add a Source parameter to the URL you provide in the workflow email.
    http://sitename/list/DispForm.aspx?ID=[Current item: ID]&Source=http://sitename
    Something like that.
    SharePoint Architect || Microsoft MVP ||
    My Blog
    Planet Technologies ||
    SharePoint Task Force

  • Audio and Video on the same page.

    Is it ok to have a separate audio and video file on the same page?  Both are set to auto play with no controls but when I try this set up the audio seams to override the video, stopping the video a few seconds later.
    I guess I could try and embed the audio into the video but if I did not have to I was not going to.
    Any suggestions or help is appreciated.
    Thanks,
    Ryan.

    You can't play both the audio and the video simultaneously, you'll need to merge them.
    Neil

  • Reusing the same jsp include multiple times on the same page

    If someone knows a way out of this
    I'd like to print out 2 records of the same data type I have a JSP include which does that.
    Now my issue is how to use the same include twice on the same page
    Ideally I would like to do the following:
    <%
    request.setAttribute("person", person1);
    %>
    <jsp:include page="./person.jsp"/>
    <%
    request.setAttribute("person", person2);
    %>
    <jsp:include page="./person.jsp"/>
    And in person.jsp
    I could have
    <h:inputText name=#{person.name}/>
    This fails in the updateModel phase - And I realize why it's failing. There really is no person managed bean.
    It's just that I am at a kind of loss as to what I need to do now -
    Am missing something or is it just impossible to use jsp:includes the way Ive tried to?

    I do not understand, have you created a backing bean named person? Have you defined it in your config file?
    Please copy/paster your backing bean code and config file.
    Normally, you can set directly the value of the bean by using some java code in your jsp instead of setting the request attribute.

  • Reading a file in the same directory as the JSP files

    Hi,
    Okay so I have my JSP files in the directory $Catalina/webapps/webservices, I also have a text fire in the same directory called users.txt
    All I want to do is open the users.txt from the JSP program and read from it. But JSP can't seem to find the users.txt.
    Code I have tried include,
    File users = new File("users.txt");
    File users = new File("http://localhost:8080/webservcies/users.txt"); Also File users = new File(new URI ("http://localhost:8080/webservcies/users.txt"));
    File users = new File("webservices/users.txt");
    I guess part of the problem is that I don't know what the JSP working directory is. I assumed it was $Cataline/work/standalone/localhost/webservices
    but even if I use,
    File users = new File("../../../../webapps/webservices/users.txt");
    It doesn't work. Does anyone know how I can read the file? Any help in this matter would be appreciated.

    From within a JSP you have a reference to a PageContext called pageContext. This has a method getServletContext(). From the ServletContext you can find the real path the servlet lives in. So...
    File basePath = new File(pageContext.getServletContext().getRealPath("/"));Now basePath contains your path $Catalina/webapps/webservices. Then it's just a matter of working relative to that, e.g.:
    File usersFile = new File(basePath, "users.txt");

  • FORM and JSP in the same page

    Hello All
    Is it possible to pass variable from a html textbox to a JSP? but they both are in the same page.
    For this purpose, I have a created a index.html, which contain two frames, top.html and bottom.jsp. There is a textbox in the top.html, it collects 2 variables and use form action "POST" to call bottom.jsp to display a graph.
    However after I run this page on Tomcat, it gave me error message in the bottom.html:
    The server encountered an internal error () that prevented it from fulfilling this request.
    Can anyone teach me how to solve this problem? Thanks a lot
    Viola
    index.html
    ===============================
    (FRAME) top.html
    <form action="bottom.jsp" method="post">
    <input type="text" name="apple">
    <input type="text" name="orange">
    ===============================
    (FRAME) bottom.jsp
    String apple = request.getParameter("apple");
    String orange = request.getParameter("orange");
    use those two variables to do something
    and display a graph

    The problem is that both pages are loaded @ the same time so when the getParameter gets executed the parameters are null and this is the probable cause of your error. Another problem is the action in form will cause the bottom to go into tops frame and not have anything to do with the other frame. If you want data to go from one frame to another while the user still sees them look @ DHTML, JavaScript and IFrames.
    HTH,
    J.Clancey

  • I have many photos with file extension of .PDD and that Photo Deluxe 4 no longer will operate in Win 7. How can I open?  Next in Elements 11, how do I load and print different pictures and different sizes options on the same page?

    I have many photos with file extension of .PDD and that Photo Deluxe 4 no longer will operate in Win 7. How can I open?  Next in Elements 11, how do I load and print different pictures and different sizes options on the same page?
    Thanks,
    Shir

    sbmgrams wrote:
    I have many photos with file extension of .PDD and that Photo Deluxe 4 no longer will operate in Win 7. How can I open?
    See here:
    Reading PhotoDeluxe PDD Files

Maybe you are looking for