Passing value to jsp page by clicking a hyperlink

I have a hyperlink in a jsp page1. The hyperlink is for another jsp page2. I have a string value in JSP page1, which I want to pass to jsp page2 when user clicks the hyperlink. Can anyone tell me what will be the suitable way to do this? Thanks.

here's the source to two very simple jsps that do what you want..
<HTML>
<HEAD>
<TITLE>
ForwardValue
</TITLE>
</HEAD>
<BODY>
<H1>
Go To GetValue.jsp
</H1>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>
GetValue
</TITLE>
</HEAD>
<BODY>
<H1>
<%= request.getParameter("value") %>
</H1>
</BODY>
</HTML>

Similar Messages

  • Passing values to jSP on button click

    Hello
    I have multiple delete buttons on the JSP page. What i want is to get the value as to which delete button was clicked. I am not sure if i shld have multiple names for the buttons. For now all have the same name since its inside a while loop.
    Also i want to confirm that the user really wants to delete the field. But i dont know how can i pass the value as well as the function at the same time through the onClick function.
    I tried type="hidden" for the field value and onClick="function" (where function is a javascript function that confirms if the user does want to delete the field). BUt in this case with type = hidden i get all the values corresponding to the field.
    Any pointers?
    heres the sample HTML code if it helps.. this one is just to show how the screen looks like. The actual JSP has the while loop.. which is also pasted below
    <HTML>
    <HEAD><TITLE>File Format Management</TITLE>
    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <SCRIPT language="JavaScript" type="text/javascript">
    <!--
    var errMsg = "";
    function confirmDelete(frm)
         var deleteSure = confirm("Are you sure you want to delete the fileType?");
         if (deleteSure)
                frm.submit();
         return deleteSure
    //-->
    </SCRIPT>
    </head>
    <body>
    <BR>
    <CENTER>
    <TABLE border="1" cellpadding="0" cellspacing="0" marginwidth=0 marginheight=0>
      <TR class="titlebar">
        <TD align="center">File Format Management</TD>
      </TR>
      <TR bgcolor="#cccccc">
        <TD>
    <B>File Types:</B>
    <p>The following file types are defined for this project.</p>
    <div align="center">
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tr><td>Filetype��</td><td># of fields��</td><th></th><th></th></tr>
    <tr><td>Demographics</td><td align="center">5</td><td><input type="submit" value="Edit"></a></td><td align="right"><input type="submit" value="Delete"></a></td></tr>
    <tr><td>Clinical</td><td align="center">17</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td>MS</td><td align="center">9</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td>HLA</td><td align="center">20</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td>SNP</td><td align="center">18</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td colspan="4"><input type="submit" value="Add new filetype..."></td></tr>
    </table>
    </div>
    <p align="center"><input type="submit" value="Return"></p>
    </td>
    </tr>
    </table>
    </body>
    </html>
    //actual while loop in JSP
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
                <tr class="titleitem"><td>Filetype��</td><td># of fields��</td><th></th><th></th></tr>
                <% if ((!fileTypesFormats.equals(null)) && (fileTypesFormats.size() > 0))
                        Iterator keyIter = fileTypesFormats.entrySet().iterator();
                        while (keyIter.hasNext())
                            Map.Entry CurrentEntry = (Map.Entry) keyIter.next();
                            String formatNos = CurrentEntry.getKey().toString();
                            String fileTypeName = CurrentEntry.getValue().toString();
                            count++;
                 %>
                       <tr class="<%=htmlObj.getClassString(count)%>">
                         <td><input type="hidden" name="filetypeName" value="<%=fileTypeName%>"><%=fileTypeName%></td>
                         <td align="center"><%=formatNos%></td>
                         <td><input type="button" value="Edit" name="editBtn" onclick="location.href='edit_delete_filetype_format.jsp'"></a></td>
                         <td align="right"><input type="button" name="deleteBtn" value="Delete" onclick='confirmDelete(this.form)'></a></td>
                       </tr>
                 <% } } %>
                        <tr class="<%=htmlObj.getClassString(count)%>"><td colspan="4"><input type="button" value="Add new filetype..." onclick="location.href='edit_delete_filetype_format.jsp'"></td></tr>
            </table>

    Thanx for your help praveen
    I appreciate that.. but i misguided you. I am sorry abt that
    I want the value of the field beside the delete box to be passed to the Server side scripting.
    so if u see the html page u see something like this
    "Demographics 4 Edit Delete "
    "Clinical 3 Edit Delete"
    //note edit and delete are buttons
    Of this when the user clicks on Delete I want the jsp to pass Demographics value to the JSP.
    Right now it will pass all the values like "Demographics Clinical" . I probably have to give different names to the buttons...lets c
    Thanx for u r help

  • Passing values between jsp pages

    Hi all,
    I am a newbie to jsp. I am trying to pass value from one jsp to another.
    Let me post the code here and make my point clear. I have 3 jsp pages and am trying to get the value into my 3rd page that was in the first page.
    This is my Test.jsp page:
    <%@page contentType="text/html"%>
    <html>
    <head><title>Test JSP Page</title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    Testing.. JSP Page
    <FORM action='Response.jsp' method="POST">
    <input type='Text' name='get_name'>
    <input type="submit" value="Click Me">
    </FORM>
    </body>
    </html>
    This is my response.jsp page:
    <%@page contentType="text/html"%>
    <%@page import = "sun.jdbc.rowset.CachedRowSet" %>
    <html>
    <head><title>Response Page</title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    Thank you... <%=request.getParameter("get_name") %>
    // I want to pass this get_name to my next page, but since request.getParameter returns an object and not a string, how will I capture the value and pass it to my next page.
    </body>
    </html>
    The 3rd jsp page is:
    <%@page contentType="text/html"%>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    // I am trying to get the value of the name here in this page.
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    </body>
    </html>
    Your help is appreciated.
    Thanks

    Hi,
    Thanks for the reply, it works. I was wondering whether this is an efficient way of doing this. What I want to do further is to setup a connection to a database and use the value I got from my previous page to query the DB and get the results and display.
    I have see some code in the java website and a lot of people do by writting a bean /class(believe bean is just a class) and then importing it and do the things that way. I have good knowledge of OO and Java as a language and would definitely love to do it this way.
    What i think i am missing is the basic idea to doing this way. So if you could let me know how to do this using java classes I would really appreciate it. If its too much to explain can u point to some good source(URL's) that explain's this. I have searched on this and all i find is code with no good explaination.
    Thanks a lot

  • Pass value between JSP pages

    I would like to pass values between pages.
    I don't want showing up on the url. Ex: some.jsp?param=value
    I don't feel it's safe.
    It's not coming from form either....
    How can I hide the value and pass it to next page?
    I want to pass the value when the user click on a hyperlink
    Thanks In Advance.
    Message was edited by:
    Theepan

    Client side information is never safe no matter what you do. If the values don't end up in the url, they are always present SOMEWHERE in the html content.
    If you don't want the values to end up in the url, rework the page so it DOES do a post form submit. You could turn the hyperlink into a javascript call that submits the form for you.

  • To pass value between jsp page

    How can I pass hidden's value from a jsp page to other?
    My code is:
    a.jsp
    <h:form id="insUser">
    <h:inputHidden id="flag" value="1"></h:inputHidden>
    </h:form>
    b.jsp
    <%String flag="";
    flag=request.getParameter("flag");
    out.print("flag="+flag);
    %>
    b.jsp shows: flag=null
    Could you help me?

    Because this hidden field id is insUser:flag, but not just flag.
    If you have subview or other naming container(s) around form, the id name might be even longer.
    Sergey : https://ajax4jsf.dev.java.net/

  • Pass values between jsp pages

    Admin1.jsp
    In this jsp page i have a drop down list with<select name=Update
    From this page i move to the page Adnim2.jsp
    Admin2.jsp
    In this page i request for the value of selected entry in the drop down list as follows
    String a=request.getParameter("Update");
    From this page i move onto a servlet UpdateContribution.java
    UpdateContribution.java
    Here i need the value of the selected entry in drop down list ie Update
    but String a=request.getParameter("Update"); does not work here and i get a Null Pointer Exception
    Please help me

    In Admin2.jsp, add a hidden form field and assign the selected value of drop-down to it. Now, you can obtain
    the selected value of drop-down in Servlet(UpdateContribution.java) using given hidden form field.
    Or,
    Store the selected value of drop-down list in session. Now, you can obtain the value in servlet(UpdateContribution.java) through session

  • Passing value from JSP to JApplet

    Hello,
    I am stuck up with a problem, can anyone please tell me how do i pass a value from a JSP page
    to a JApplet,
    and the parameter passed through JSP should be displaed in the JTextArea.
    It would be kindful if any of you could help.
    Thanks
    Sanam

    hello,
    thanks for reply.
    I know how to pass parameters from html,
    I want to pass values from jsp page,
    and i dono how to do it, may be we cann pass values through url connection but i dono how.
    if anone knows plz help me in solving this.
    i hvae posted my applet code.
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.JToolBar;
    import javax.swing.JButton;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    <applet code = "DocApplet" width = 500 height =5000>
    </applet>
    public class DocApplet extends JApplet
         private JPanel jp;
         private Container cp;
         private JTextArea jt;
         private JToolBar tb;     
         private JScrollPane sp;
         private String annotation;
         private String url;
         private Connection con;
         private Statement stmt;
         public void init()
              jp = new JPanel();
              cp = getContentPane();
              jt = new JTextArea();
              tb = new JToolBar();
              sp = new JScrollPane(jt);
              repaint();
         public void start()
              jp.setLayout(new BorderLayout());
              jp.add(tb, BorderLayout.NORTH);
              jp.add(sp, BorderLayout.CENTER);
              jt.setBackground(Color.BLACK);
              jt.setForeground(Color.WHITE);
              setContentPane(jp);
              addButtons(tb);
              repaint();
         public void run()
              repaint();
         public void paint()
         private void addButtons(JToolBar tb)
              JButton button = null;
              button = new JButton("Save");
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
              tb.add(button);
    }

  • How to call & pass values to custom page from seeded page table region

    Hi All,
    can anyone tell me how to call & pass values to custom page from seeded page table region(Attribute is not available in seeded page VO)
    it is urgent. plssss
    Regards,
    purna

    Hi,
    Yes, we do this by extending controller, but you can also try this without extending controller.
    1. Create Submit Button on TableRN using personalization.
    2. Set "Destination URI" property to like below
    OA.jsp?page=/<yourname>/oracle/apps/ak/employee/webui/EmpDetailsPG&employeeNumber={@EmployeeId}&employeeName={@EmployeeName}&retainAM=Y&addBreadCrumb=Y
    Give your custom page path instead of EmpDetailsPG.
    EmployeeId and EmployeeName are VO attributes(Table Region)
    If you dont have desired attribute in VO, then write logic in your custom page controller to get required value using parameters passed from URL path.
    In this case, only personalization will do our job. Hope it helps.
    Thanks,
    Venkat Y.

  • Passing values between jsp and php

    hi there, is it possible to pass values between jsp and
    php? i really need to find out the way if there is
    any. thanks in advance
    -azali-

    Yes, there are a few ways to do this.
    1) Think about using Cookies.
    2) Maybe use a Redirect passing the values in the Query string.
    3) Retain the data in a repository in the back end.
    4) Using Hidden fields within your pages.
    I am sure you can use these Idea's for a base to develop other methods on how to pass values back and forth from JSP -> PHP and vice versa.
    -Richard Burton

  • Urgent! pass parameters between jsp pages

    Does anyone can give an example about how to pass parameters between jsp pages?
    This is what I do:
    pageContext.forward("pag_loginc.jsp?p_idusr=" + strUsr + "&c_password=");
    But when deployed is not working.
    Help is needed.

    can you put that stuff in the session context in the first page, then pull it out in the second page?

  • How to pass value from jsp to java bean

    I have huge problem . How to pass value from jsp value to java bean.Please replay me soon

    Use the <jsp:setProperty> tag. There are several ways to use it. The one you probably want is:
    <jsp:setProperty name="bean_name"  property="property_name"  value="the_value_you_want_to_set"/>

  • Pass hidden values to same page by clicking on href

    I have A.jsp page which has some dynamic hidden fields.The respective code is given below:
    <script language="javascript">
    function submitForm()
    {document.main.action="main.jsp"; document.main.submit(); }
    </script>
    <form name="main">
    HOME
    <input type="hidden" name="user_p" value="<%=user1%>"/>
    <input type="hidden" name="p" value="Hello"/>
    </form>
    When I click on link-HOME, it reconnect to A.jsp but does not pass the hiddden values. Could you help me?

    It did not work.Now after modifying the code for this (I did this because some browser does not support two functions ,like in href. By thinking that it could be the problem)
    <script language="javascript">
    function submitForm()
    document.main.action="main.jsp"; document.main.submit(); }
    </script>
    <form name="main" method="POST">
    HOME
    <input type="hidden" name="user_p" value="<%=user1%>"/>
    <input type="hidden" name="p" value="Hello"/>
    </form>
    Could you explain with working code?

  • Passing values to next page on Update image click?

    Hi Everyone,
    I have developed one OAF page which has onw table data to show. The last column is Update Image icon.
    Columns are like this: Eno, enmae, comm, address, salary, update.
    On clicking on update icon on any row the corresponding Eno and Ename should be passed to next Update page and these two values has to be displayed on teh Update page.
    How can i do that?
    Please help...
    Thanks.

    PPR event on Update Image would do the magic for you.
    Go to the properties of the Image icon and select below
    1) Action Type : fireAction
    2) Event : updateEmp (This event needs to be captured in the page CO)
    3) Parameters :
    a)pEmpNo : ${oa.current.EmpNoID} (EmpNoID is the view attribute for Employee Number. You keep proper name of your VO attribute here)
    b)pEmpName : ${oa.current.EmpName} (EmpName is the view attribute for Employee Name. You keep proper name of your VO attribute here)
    c) Add more parameters if you want to pass maore
    4) In processFormRequest of the page catch the event 'updateEmp' and forward to the next page
    String eventRaised = pageContext.getParameter("event");
    if ("updateEmp".equalsIgnoreCase(eventRaised)) {
    HashMap actionHashMap = new HashMap();
    String pEmpNo= pageContext.getParameter("pEmpNo");
    String pEmpName = pageContext.getParameter("pEmpName");
    actionHashMap.put("pParamEmpNo", "{!!" + pageContext.encrypt(pEmpNo)); --always encrypt
    actionHashMap.put("pParamEmpName", "{!!" + pageContext.encrypt(pEmpName ));
    pageContext.setForwardURL(include the next page function/URL and other parameters along with actionHashMap);
    5) In the next page CO, get the passed parameters in processRequest using
    String pEmpNo= pageContext.getParameter("pParamEmpNo");
    String pEmpName = pageContext.getParameter("pParamEmpName");
    --Do your other stuff on how to use these parameters
    Hope this will direct you properly.
    Regards,
    Peddi

  • Post and Get value in jsp page

    I have two pages
    1. Occasion.jsp
    2. Occasionsdetail.jsp
    i select values from database in occasion for example
    a
    b
    c
    they become links when i click on one of these links it call Occasiondetail form. Where i want to display details of that particular record
    On occasion page i am passing value which is displaying in last of address bar of occasionsdetail page
    How can i use that value in occasiondetail form
    both files code is pasted
    Occasions.jsp
    <head>
    <title>
    Riphah International University
    </title>
    </head>
    <body bgcolor="#ffffff">
    <form method="POST" action="occasionDetails.jsp">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center" bgcolor="#6633FF"> <strong><font color="#000000">Occasions</font></strong> </td>
    </tr>
    <% org.riu.db.utility.DBHandler dbHandler = new org.riu.db.utility.DBHandler();
    if ( dbHandler.getConnection() ) {
    org.riu.db.datastructureaccess.OccasionAccess occasionAccess = new org.riu.db.datastructureaccess.OccasionAccess(dbHandler);
    java.util.ArrayList occasions = occasionAccess.getOccasions();
    if ( occasions == null || occasions.isEmpty() ) { %>
    <tr>
    <td align="center">
    </td>
    </tr>
    <% } else {
    for ( int i = 0; i < occasions.size(); i++ ) {
    org.riu.db.datastructure.Occasion occasion = (org.riu.db.datastructure.Occasion) occasions.get(i); %>
    <tr>
    <td align="center">
    <a href="occasionDetails.jsp?OccasionID <%=occasion.getOccasionID() %> "><%= occasion.getName() %></a> <%= " on " + occasion.getDate() %><%= + occasion.getSemesterID()%>
    </td>
    </tr>
    <tr>
    <td align="center">
    <hr />
    </td>
    </tr>
    <% }
    } %>
    </table>
    <p align="center">Back</p>
    </form>
    </body>
    </html>
    OccasionDetail.jsp
    <head>
    <title>
    Riphah International University
    </title>
    </head>
    <body bgcolor="#ffffff">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center" bgcolor="#6633FF"> <strong><font color="#000000">Occasion Details</font></strong> </td>
    </tr>
    <% org.riu.db.utility.DBHandler dbHandler = new org.riu.db.utility.DBHandler();
    if ( dbHandler.getConnection() ) {
    org.riu.db.datastructureaccess.OccasionAccess occasionAccess = new org.riu.db.datastructureaccess.OccasionAccess(dbHandler);
    java.util.ArrayList occasions = occasionAccess.getOccasionswhere(I want to use that value here);
    // new Integer(request.getParameter("OccasionID")).intValue();
    if ( occasions == null || occasions.isEmpty() ) { %>
    <tr>
    <td align="center">
    </td>
    </tr>
    <% } else {
    for ( int i = 0; i < occasions.size(); i++ ) {
    org.riu.db.datastructure.Occasion occasion = (org.riu.db.datastructure.Occasion) occasions.get(i);%>
    <tr>
    <td align="center">
    Venue: <%= occasion.getVenue()%>
    </td>
    </tr>
    <tr>
    <td align="center">
    Time: <%= occasion.getTime() %>
    </td>
    </tr>
    <tr>
    <td align="center">
    <hr />
    </td>
    </tr>
    <% }
    } %>
    </table>
    <p align="center">Back</p>
    </body>
    </html>

    Are your records javascript variables? If so, you can use a json formatter to serialize the records to a string and send it from PageA to PageB using mechanism that supports strings (i.e. query parameter, cookie, etc).
    You can learn more about json at http://www.json.org/ and about a json serializer/parser at http://www.json.org/js.html .

  • Passing value from JSP to Action in Struts

    Hi,
    I am populating JSP page with rows retrieved from the database and
    represented as a List of Beans in forEach loop:
    <c:forEach var="list" items="${OperationsForm.OperationsList}">
    <c:choose>
    <c:when test="${list.isCompleted =='Y'}" >
    <td width="100">Completed</td>
    <td width="100"> </td>
    </c:when>
    <c:otherwise>
    <td width="100">Pending</td>
    <td width="100"><input type="image" onclick="
    rowId=value; form.action='action.do?command=notify'"
    value="${list.OperationId}" />
    </td>
    </c:otherwise>
    </c:choose>
    </tr>
    </c:forEach>
    Have hidden field: html:hidden property="rowId" value="-1"/>
    User is clicking the button corresponding to one of the rows
    and I need to pass the value of that rowId to the Action class, so it does
    something in the database [action completed]
    Now how do I pass it , is that the right way of doing it with calling
    request.getSession().getAttribute(rowId) in the Action class ?
    As of now I am getting Javascript error "Object doesn't support this
    property or method", complaining about rowId=value;
    Using Struts 1.3
    Please help !
    TIA,
    Oleg.

    So what you are saying is that I should add rowId here:
    <input type="image" onclick="form.action='action.do?command=notify&rowId='
    ${list.OperationId}"/> , correct ?
    I am not sure that it will work, especially with Struts tag.
    I will probably try something like:
    <html:submit onclick="form.action='action.do?command=notify'" value="${list.OperationId}">
    I am relatively new to Struts, so now sure what will work or not and how to do it better. How do I catch the submitted value in the Action in either of these 2 cases, via action.getSession().getProperty("rowId") /
    action.getSession().getProperty("submit") ?
    I would probably do it as a URL rather than changing the action of the form.I will have to create a new action anyway to process that row [which is sending user e-mail regarding that row data/event].
    Is the id the only thing you have to pass in?
    Or do you need other values from the screen?Selected rowId is probably the only thing I care about, can access values from the Form in Action.
    Thank you,
    Oleg.

Maybe you are looking for

  • Calling a method, some help please

    Hi, I'm trying to run or call a method in my main Class which has received a StringBuffer value from another method in a separate class. I'm unsure about how to call this particular method. The way the method works is receiving some XML packets from

  • HT4796 What happens with my old user account on my MacBook?

    Once this process is done, is there a way to delete my first user account on my Mac? I mean, this is saying that everything will transfer to a new account; it won't merge with your current account on the Mac. I only want ONE user account on my MacBoo

  • Portfolios in Acrobat X

    Is it possible in Acrobat X to have the same disposition as it was  in Acrobat 9 pro ?. Double-click in file open a previewer only for Pdf file and going to View->Portfolio-> preview is a quite boring operation;

  • Column Type Conversion Script

    Hi All, I would like to be able to perform a Column Datatype conversion on a database. I want to find all tables for a schema that has a CHAR type column and then convert it into VARCHAR2 of the same length and MODIFY existing data with a TRIM functi

  • How do you download notes to an ipod

    I can't figure out how to download notes to my ipod.