Passing value from JSP to JSPDynPage onclick of link

I have extracted a value in the JSP page and i want to send this value back to the JSPDynPage on click of a link(the link is dependent on the value).
How can i do that?

hi Sujoy,
you can pass values by using beans and display the passed data in a new jsp page.
firstly create a jsp page,that accepts user data,say for example i am placing a text box and a button,
next,create a jspdyn page---
private final static int INITIAL_STATE = 0;
    private final static int FINAL_STATE = 1;
    private int state = INITIAL_STATE;
    private final static String BEAN_KEY="nameBean";
    public void doInitialization(){
      IPortalComponentRequest request=(IPortalComponentRequest) this.getRequest();
      IPortalComponentContext ctxt=request.getComponentContext();
      displayNameBean mybean = new displayNameBean();
public void doProcessAfterInput() throws PageException {
         InputField myInputField = (InputField) getComponentByName("user_name");
if (myInputField != null) {
IPortalComponentRequest request=(IPortalComponentRequest) this.getRequest();
IPortalComponentContext ctxt = request.getComponentContext();
             displayNameBean mybean1=(displayNameBean)ctxt.getValue(BEAN_KEY);
    public void doProcessBeforeOutput() throws PageException {
      switch (state){
           case INITIAL_STATE:
           case FINAL_STATE:
    public void onButtonClick(Event event) throws PageException {
finally display this value in a new jsp page as follows--
<jsp:useBean id="nameBean" scope="application" class="NewProject.bean.displayNameBean" />
<%@ taglib uri= "tagLib" prefix= "hbj"%>
<hbj:content id="myContext" >
  <hbj:page title="PageTitle">
   <hbj:form id="myFormId" >
as simple as that!!
P.S:Please reward points for helpful answers.

Similar Messages

  • Passing value from JSP to JApplet

    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 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.sql.*;
    <applet code = "DocApplet" width = 500 height =5000>
    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);
         public void start()
              jp.setLayout(new BorderLayout());
              jp.add(tb, BorderLayout.NORTH);
              jp.add(sp, BorderLayout.CENTER);
         public void run()
         public void paint()
         private void addButtons(JToolBar tb)
              JButton button = null;
              button = new JButton("Save");
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)

  • 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"/>

  • Passing value from JSP to scriptlet

    I am trying to find a way to pass a value from jsp to the scriptlets, i.e.
    <c:set var="testValue" value="123" />
    the above code just demonstrates what I was trying to achieve, by passing the value from the jsp into the scriptlet.
    Can someone tell me if there's an easy way to do this?
    Thank you.

    Note, using scriptlet code on your page is generally something to be avoided. 99% of what you should be doing on a JSP page can be done with EL/JSTL. If you can't do it with EL/JSTL then it probably belongs in a servlet/bean.
    I always aim for 100% scriptlet free jsp pages.
    Having said that, I can still answer your question: EL attributes are stored in the scope - page, request, session, application
    ${testValue} is equivalent to pageContext.findAttribute("testValue").
    The <c:set> tag example doesn't specify a scope, so therefore you could get it like this:
    <c:set var="testValue" value="123" />
    String testValue = (String)pageContext.getAttribute("testValue");
    %>alternatively exploit the feature of the useBean tag that creates a scriptlet variable:
    <c:set var="testValue" value="123" />
    <jsp:useBean id="testValue" type="java.lang.String"/>
    %>Note that the EL variable and the Scriptlet variable are initially pointing at the same String.
    But changing the string in scriptlet code will change the value it is pointing at, while leaving the EL variable untouched.
    If you have a List in scope, and sharing it between EL and scriptlet variables then any changes to the list would be reflected because they both point at the same List object.

  • Passing value from JSP to Action in Struts

    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:when test="${list.isCompleted =='Y'}" >
    <td width="100">Completed</td>
    <td width="100"> </td>
    <td width="100">Pending</td>
    <td width="100"><input type="image" onclick="
    rowId=value; form.action=''"
    value="${list.OperationId}" />
    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 !

    So what you are saying is that I should add rowId here:
    <input type="image" onclick="form.action=''
    ${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=''" 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,

  • How to pass value from JSP to Javascript?

    I want to pass 2 integers to Javascript to do checking? How can I do that?

    Well, it is very simple, Follow these steps.
    1. Have a form with fields
    2. On submit validate the form using javascript
    3. If the javascript returns false do not submit the form
    4. if the javascript returns true submit the form
    5. The destination jsp page will handle the db operations.
    1. <form name="frm1" action="dbcheck.jsp">
    <input type="text" name="txt1">
    <input type="button" value="submit" onClick="return validate();">
    put the above piece of code in the <body> tag
    2. Upon submit the js function validate() will be called :
    <script language="javascript">
    function validate() {
    if(document.frm1.txt1.value="") {
    alert("enter text");
    return false;
    else {
    document.frm1.submit(); // i am not sure whether the () after submit is required or not
    put the above piece of code in the <head> tag.
    3. Now when the submit happens, the control goes to the dbcheck.jsp
    this is dbcheck.jsp:
    String str = (String) request.getParameter("txt1");
    ------other db operations go here --------
    "txt1" is the field name of the textbox from the form u previously submitted.
    all da best

  • Passing value from jsp to java

    Thanks for reading my query.I am having a jsp page which gets the input from the user from a confirm box(javascript). This input i need to process in my java can i do that

  • Passing values from javascript in pop up window to parent jsp

    I am trying to pass values from a pop up window to the main window that popped this child window , with the idea to have the parent window refresh itself with value from pop up window.But the values are not going through.I do a request on the hidden variable but when the parent
    jsp refreshes , the variable is still null...
    The following is the code i have .
    Parent jsp:a.jsp
    <form name='summary'>
    <input type=hidden name=customerid value="">
    <input type="button" class="textButton" name="action" value="customerlist" onClick="javascript:openWin('b.jsp','800','350')">
    function openWin(loc, w, h) {
    var newWin = window.openloc,"HTML",'dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h);
    String optionVal = request.getParameter("customerid");%>
    var user = "<%= optionVal%>";
    child jsp- b.jsp (pop up window)
    function closer(){
    var val =;
    window.opener.document.summary.customerid.value = val;
    <form name = formname>
    <input type="text" name="id" value = ''>
    <input type="button" class="textButton" value="select"
    Any ideas on what i am missing

    use window.opener.document.forms[0].filedname.value = 'value u need to set'

  • How to Pass values from XML to JSP??? Urgent Please Help me

    Hi guys,
    I am new to XML, I want to pass values from XML to JSP. I have a xml file with attributes, I should send this values to a JSP file. How is it??? Please Help guys.... its very urgent. Please send me how to do it with an example or atleast any urls related that....
    Looking for ur favourable reply.
    Thanks in advance,

    in a servlet :
    parse your xml file (see how at the end of the post) and
    put the values you want in the request attributes
    request.setAttribute("value1", value1);
    ...redirect to the jsp
    in the JSP:
    get the wanted attributes:
    String value1=(String)request.getAttribute("value1");To learn how to parse a xml file, pay a look at this page, it explains how to read the XML document to build an object representation, and then how to navigate through this object to get the data

  • Passing value from one jsp to another?

    how to pass value from one jsp to another? i have a value assigned in the link, i want to pass that value to another jsp page?
    please help with code?

    Instead of the value being passed, i am getting a null value.
    Here is my calendar code:
    <%@page import="java.util.*,java.text.*" %>
    <title>Print a month page.</title>
    <body bgcolor="white">
                  boolean yyok = false;
                  int yy = 0, mm = 0;
                  String yyString = request.getParameter("year");
                  if (yyString != null && yyString.length() > 0)
                          yy = Integer.parseInt(yyString);
                                  yyok = true;
                       catch (NumberFormatException e)
                          out.println("Year " + yyString + " invalid" );
                  Calendar c = Calendar.getInstance( );
                  if (!yyok)yy = c.get(Calendar.YEAR);  
                         mm = c.get(Calendar.MONTH);
                  <table align="center">
                       <form method=post action="calendar.jsp">
                          Enter Year : <select name="year">
                 for(int i= yy;i<=2010;i++)
                  <OPTION VALUE= <%=i%> > <%=i%> </option>
                      <input type=submit value="Display">
    String[] months = {"January","February","March",
                    "October","November", "December"
    int dom[] =     {
                        31, 28, 31, 30,
                        31, 30, 31, 31,
                        30, 31, 30, 31
                int leadGap =0;
    <div id="t1" class="tip"><table border="4" cellpadding=3 cellspacing="3" width="250" align="center" bgcolor="lavender">
    <td halign="centre" colgroup span="7" style="color:#FF0000;">
              GregorianCalendar calendar =null;
              for(int j=0;j<12;j++)
                        calendar = new GregorianCalendar(yy, j, 1);
                  int row = 1 ;
                  row = row + j;
              <colgroup span="7" style="color:#FF0000;">
              <tr align="center">
              <th colspan=7>
                  <%= months[j] %>
                  <%= yy %>
        leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
        int daysInMonth = dom[j];
        if ( calendar.isLeapYear( calendar.get(Calendar.YEAR) ) && j == 1)
        out.print(" ");
          for (int h = 0; h < leadGap; h++)
        for (int h = 1; h <= daysInMonth; h++)
          out.print("<a href=desc.jsp>" + h + "</a>" );
        if ((leadGap + h) % 7 == 0)
    if( row%3 != 0)
    </html>I need to pass the value in 'h' to the desc.jsp page.
    my code for desc.jsp is :
    <body bgcolor="lightblue">
    <form method=post action="Calenda.jsp">
    <%= request.getParameter("h") %>
    <h2> Description of the event <INPUT NAME="description" TYPE=TEXT SIZE=20> </h2>
    </html>But i am not able to pass the value. The 'h' value contains all the date. i want to pass only a single date, the user clicks to the other page. please help

  • URGENT: Passing Array from JSP to a Stored Procedure

    Can some one please help me understanding how can I pass array from JSP page to a stored procedure in database.
    Thanks in advance.

    I tried and was successful in passing array values to the stored database procedure.
    How can I use this class in JSP? Like I have first JSP where in I will collect input from the user and then submit it to the second JSP - that needs to call the to pass the values as array to the database.
    How should I call this java code in my second JSP?
    Thanks in advance.

  • Passing value from JavaScript window to form

    Coul'd You help me?
    I have a test form. I open new JavaScript window from this form. I generate list of authors in this window by the procedure show_list. I want to pass value from JavaScript window back to test form, but
    the command "window.opener.document.forms[idx_form].elements[idx_fld].value = val;"
    don't pass value to test form. Where is mistake?
    Thanks Vaclav
    -------------- test form --------------
    <META http-equiv="Content-Type" content="text/html; charset=windows-1250">
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Comment out script for old browsers
    function get_list(frm, fld)
    var idx_form, idx_fld;
    idx_form = get_idx_form(frm);
    idx_fld = get_idx_field(idx_form, fld);
    var w = open ("http://vasekora/pls/portal309/ahs.RD_CISEL.SHOW_LIST" + "?startPg=1" + "&master_fld=" + "ID_AUTHOR" + "&slave_fld=" + "NAME" + "&ownr=" + "REDAKCE" + "&tbl_name=" + "AUTHORS" + "&cmd_qry=" +"" + "&idx_form=" + idx_form + "&idx_fld=" + idx_fld,"wn_Authors","width=500,height=600,resizable=yes,menubar=yes, location=yes");
    if (w.opener == null)
    w.opener = self;
    function get_idx_form(p_form_name)
    var v_index, v_full_name, v_return;
    for(v_index=0; v_index < document.forms.length; v_index++)
    v_return = -1;
         v_full_name = document.forms[v_index].name.split(".");
    if (v_full_name == p_form_name)
         v_return = v_index;
    return v_return;
    function get_idx_field(idx_form, field_name)
    var v_index, v_full_name, v_return;
    for(v_index=0; v_index < document.forms[idx_form].length; v_index++)
    v_return = -1;
         v_full_name = document.forms[idx_form].elements[v_index].name.split(".");
    if (v_full_name == field_name)
         v_return = v_index;
    return v_return;
    <FORM NAME="f_aut_new" ACTION="javascript:testclose()" METHOD=POST TARGET="_blank">
    <INPUT TYPE="text" NAME="id_aut">
    <IMG SRC="images/list.gif" alt="Seznam" border="0" align=bottom><BR><BR>
    <INPUT TYPE="submit" VALUE="Save">
    <INPUT TYPE="reset" VALUE="Cancel">
    -------------------- end test form --------------
    procedure show_list
    startPg integer,
    master_fld varchar2,
    show_fld varchar2,
    ownr varchar2,
    tbl_name varchar2,
    cmd_qry varchar2,
    idx_form integer,
    idx_fld integer
    TYPE cur_typ IS REF CURSOR;
    c cur_typ;
    c_cnt cur_typ;
    i integer;
         pg rd_types.pages_t;
    odkaz varchar2(4000);
    bk_url varchar2(4000);
         s1 varchar2(4000);
         var_mfld integer;
         var_sfld varchar2(8000);
         bl boolean;
         var_cmd varchar2(2000);
    htp.p('<SCRIPT LANGUAGE="JavaScript">');
    htp.p('<!-- Comment out script for old browsers');
    htp.p('function Close_List(val, idx_form, idx_fld)');
    htp.p('window.opener.document.forms[idx_form].elements[idx_fld].value = val;');
    if cmd_qry is null then
    s1 := 'SELECT a.'||master_fld||', a.'||show_fld||' FROM '||ownr||'.'||tbl_Name||
    ' a ORDER BY a.'||show_fld;
    var_cmd := UPPER(cmd_qry);
    s1 := 'SELECT a.'||master_fld||', a.'||show_fld||' FROM '||ownr||'.'||tbl_Name||
    ' a WHERE UPPER(a.'||show_fld||') LIKE ''%'||var_cmd||'%'' ORDER BY a.'||show_fld;
    end if;
    i := 1;
    OPEN c FOR s1;
    FETCH c INTO var_mfld, var_sfld;
    IF i >= pg.StartRec AND i <= pg.EndRec THEN
    odkaz :=''||var_sfld||'';
    htp.p(i||': '||odkaz||' ('||var_mfld||')<BR>');
         IF i > pg.EndRec THEN
         END IF;          
    END IF;
    END IF;
    i := i + 1;
    htp.p('<BR><B><INPUT TYPE=BUTTON ONCLICK="javascript:self.close();" VALUE="Close"></B><BR><BR>');
    CLOSE c;

    If this makes any difference: Instead of using "var w = open..." try "var w ="

  • 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"%>
    <head><title>Test JSP Page</title></head>
    <%-- <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">
    This is my response.jsp page:
    <%@page contentType="text/html"%>
    <%@page import = "sun.jdbc.rowset.CachedRowSet" %>
    <head><title>Response Page</title></head>
    <%-- <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.
    The 3rd jsp page is:
    <%@page contentType="text/html"%>
    <head><title>JSP Page</title></head>
    // 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" /> --%>
    Your help is appreciated.

    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

  • 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

    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

  • Passing values from a FORM to another FORM

    I have to pass values from FORM "A" to FORM "B". What is the best way to do this?\
    Can I use a GLOBAL variable?

    I think he meant the global namespace.
    You set a :global_your_name_here to a value and that value is available in your entire application. See the help file section on the global namespace for more information.
    Forms parameters are parameters that you form picks up from the outside when it starts. The calling entity must supply them in the URL or they will be set to null. You set them up in the object navigator in the Parameters node.

Maybe you are looking for

  • OBIEE MUD - Empty Presentation Folders Disappearing after checkout

    Hello , We are facing an issue when checking out a project from Master Repository configured in MUD environment. Empty presentation folders in subject area's are disappearing when a project is checked out. I confirmed Master repository has all the em

  • ITunes automatically imports music after re-boots (damaged .itl file)

    Every time I start ITunes after my computer has been re-booted, ITunes starts importing my music library and says I have a damaged Music Library file (itl). If I allow ITunes to import my music files then it works fine (all playlists and ratings inta

  • Decimal places are not permitted for asset useful life

    Dear SAP experts, I need to post a new net book value on a new depreciation area 50 for fixed assets. The new deprecation for depreciation area 50 will start in July 2011 on all existing (also fully depreciated or to be disposed) assets with a differ

  • Removing photo albums from iPhone & iPad

    I Have several photo albums on my iPhone and iPad that I want to delete, but when viewing photo albums and click on "edit", there's no option to remove anything.  I've logged into my cloud account to remove them, but there's nothing referring to phot

  • Creating Max Querry

    I am looking to create query to find a Maximum value in a column called "total_full_energy_b" between the dates of X and Y.  The dates are all sent and live in column "cdate".  Any help would be greatly appreciated. My SQL programmer is on vacation a