Get textfield value and put it session  JSP

Hi all .
I have issuse with Session . this the code . file name (order.jsp)
%>
<p>Compute</p>
<table width="354" border="1">
<tr>
<td width="36" scope="col"> </td>
<td width="148" scope="col">Computer Type</td>
<td width="148" scope="col">Price</td>
</tr>
<%
while (rset.next ()) {
%>
<tr>
<td><input type="text" name="compno" value="<% out.print (rset.getString ("COMPUTERID"));%>"</td>
<td><input type="text" name="compty" value="<% out.print (rset.getString (2));%>"</td>
<td><input type="text" name="comppr" value="<% out.print (rset.getString (3));%>"</td>     
*<td width="61"><a href= "detailorder.jsp?<% session.setAttribute("comp", request.getParameter("compno"));*
*     String str=(String)session.getAttribute("comp");     *
*     System.out.println("file name is"+str);%>=">Add <%=str%></a></td>* </tr>
<%
rset.close();
pstmt.close();
%>
my problems is that I would to get "COMPUTERID" value and put it in "comp" and save it as session .
please help
raid
Edited by: raid200 on Apr 23, 2008 12:40 PM
Edited by: raid200 on Apr 23, 2008 12:41 PM

Copied from a newly opened topic:
raid200 wrote:
Hi
Thanks for your help . I can take one textfield value and send it to another jsp file
BUT I would to take all textfield in the row that I would use it .
Code .
<p>Compute</p>
<table width="354" border="1">
<tr>
<td width="36" scope="col"> </td>
<td width="148" scope="col">Computer Type</td>
<td width="148" scope="col">Price</td>
</tr>
<%
while (rset.next ()) {
%>
<tr>
<td><input type="text" name="compno" value="<% out.print (rset.getString ("COMPUTERID"));%>"</td>
<td><input type="text" name="compty" value="<% out.print (rset.getString (2));%>"</td>
<td><input type="text" name="comppr" value="<% out.print (rset.getString (3));%>"</td>     
<td width="61"><a href=" "detailorder.jsp?compno=<%= rset.getString("COMPUTERID")%">>                               <%session.setAttribute("compna",rset.getString(2));
                              session.setAttribute("comppr",rset.getString(3)); %>"> BUY ME! </a></td>
</tr>
In the detailorder.jsp::::::
String selectedCompId = request.getParameter("compno");
     session.setAttribute("comp", selectedCompId);
String computerid=(String) session.getAttribute("comp");
String computername=(String) session.getAttribute("compna");
String computerprice=(String) session.getAttribute("comppr");
in the detailorder.jsp ("""""the compna and comppr give the last record in formation""""""")
Please Help.
Raid</a>
You question shows that you still don't understand how JSPs work.
Try reading [this article|http://www.javaranch.com/journal/200510/Journal200510.jsp#a1].
You seem to think that the session.setAttribute call is done when you click the link. This is definitely NOT the case.
All of the java code runs (including all of those session.setAttribute) calls, and produces HTML. So it will store each element into session, overwriting the previous one.
To get information from one jsp to another you either pass parameters or use session attributes.
I showed you how to pass the selected id as a parameter, that you could retrieve in the next JSP.
So you can get the compid.
You could pass the other values as parameters as well - thats one approach.
Alternatively you could use the id to look up the data from the database again.
Alternatively you could store the +entire list+ of computers in the session, se the selected id to determine which one of those was selected, and get the answers like that.
The full solution to my mind would be to write a bean method that executes the query, and generates a List of java Objects representing your information.
You can then put that list in the session, and use it to both generate this JSP and get the information once the user selects one line.
Hope this helps,
evnafets

Similar Messages

  • How to get the values of an Array using JSP Tags

    Hey guys,
    I need some help. I've splited a String using
    fn:split(String, delim) where String = "1,2,3,4" and delim is ,
    This method returns an Array of splited Strings. how do i get the values from this array using jsp tags. I don't wanna put java code to achive that.
    Any help would be highly appreciated
    Thanks

    The JSTL forEach tag.
    In fact if all you want to do is iterate over the comma separated list, the forEach tag supports that without having to use the split function.
    <c:set var="list" value="1,2,3,4"/>
    <c:forEach var="num" items="${list}">
      <c:out value="${num}"/>
    </c:forEach>The c:forTokens method will let you do this with delimiters other than a comma, but the forEach tag works well just with the comma-delimited string.

  • How to get textfield values from a tableRowGroup

    I have textfield in a table.
    my problem is
    How to get textfield values from a tablerowgroup1.

    I have created getQuantity and setQuantity properties in my session bean and mapped text property of tabletextbox to session bean quantity.
    also used map to set and reatrieve quantity values.
    I am getting error for bean type quantity.

  • My mac book pro crashed and the logic board died. They said that i could get the hard drive out and it should have all my files on it. How do i get them off and put them on my new computer?

    My mac book pro crashed and the logic board died. They said that i could get the hard drive out and it should have all my files on it. How do i get them off and put them on my new computer?

    Mj
    Do you mean a case for the external hard drive? See here. Hope this may be helpful to you.
    Regards,
    Joseph

  • How can i get the value stored in the session object using its sessionid

    how can i get the value stored in the session object using its sessionid by running stand alone java application

    myforum wrote:
    how can i get the value stored in the session object using its sessionid by running stand alone java applicationThis does not seem to make sense! You need at least to give a lot more detail of what you are doing.

  • Getting value and put it in a 'variable'

    Hi,
    If I'm connected to the WLST online, how can I get the current domainname
    and put that in a variable so that I can use this for the other wlst
    commands?
    Bart

    <b>cd("/")<br>
    domName = cmo.getName()</b>
    <br>
    <br>
    or<br><br>
    <b>cd("/")<br>
    domName = get('Name')</b>

  • Getting listbox contents and putting in bean

    Hey!
    I can't seem to think up the code so that I can get elements in a listbox and put it into a bean. I already know how to populate the listboxes. Can you call the name of the listbox within the JSP tags? If I have a listbox named "myListBox", can I use the name within JSP?
    regards
    Romaine

    Maybe what I'm doing is wrong..
    I'm trying to do is to put all the data into a bean then it's the bean that gets sent to the servlet. I'm not also sure if I've written the bean right.
    Heres kind of the hierarchy. I'll sort of represent it in an xml-ish fashion
    <TheBean>
    <String>nameone</String>
    <String>nametwo</String>
    <Vector>
    ... // Strings
    </Vector>
    </TheBean>
    I've decided to write the bean like that because there is no definite size for when I get the elements in the listbox.
    Maybe I should just trash the whole bean thing and just submit everything to the servlet and do that thing you said about using a hidden field and split the values.
    What do you guys think?

  • How to get the values and attributes of Longlived processes by using ProcessID.

    Hi Experts,
    For  every process we creates, LC ES2 creates processID.
    we know that if you creates  a long lived process, all  the  values which are in proces will be stored some where  in DB.
    Here my requirement is by using  processID I need to get all/some values/variables stored in database.
    I am not able to get values using processID. Here I don't have clue on  how to get the values.
    Please tell me  how to get the same by using  Process Management. Link/guide would be helpful
    Thanks
    Praveen.

    Searchable means you can put a filter criteria on it (e.g. where amount > 50000)
    Visible means you can add have this column returned as an output (and therefore you can add it as column in listview and see it in Task Details).
    These two attributes were provided so that queries could be done against the process variables, but the exact contents of the variables are not allowed to be seen.

  • How to get the value in java script to JSP

    Hi,
    I have written an onclick function on each row and passing the primary key of the table to the javascript function. I want the value which I have passed to the javascript back in the jsp to delete the particular row. How can I achieve this.
    Thanks

    Thank you for your reply!! Here I am getting the values only into the javascript after I click a particular row in the table. So for the bean and action to get that particular vale I think I have to submit the form and then get the values back because its initially showing null. How do I submit the form and get the value back, so that I can delete particular row?

  • Get Old Value and the new value based on the date

    Hi
    I have a table called roster created below with following insert statements.
    CREATE TABLE ROSTER
    ROSTER_EMPLOYEE_DEF_ID NUMBER,
    EMPLOYEE_ID NUMBER,
    DEFINITION_REGION_CODE NUMBER,
    DEFINITION_DISTRICT_CODE NUMBER,
    DEFINITION_TERRITORY_CODE NUMBER,
    START_DATE DATE,
    END_DATE DATE
    INSERT INTO ROSTER
    (ROSTER_EMPLOYEE_DEF_ID,EMPLOYEE_ID,DEFINITION_REGION_CODE,DEFINITION_DISTRICT_CODE,DEFINITION_TERRITORY_CODE,START_DATE,END_DATE)
    VALUES
    (1,299,222,333,444,'1-JUN-2011','30-JUN-2011')
    INSERT INTO ROSTER
    (ROSTER_EMPLOYEE_DEF_ID,EMPLOYEE_ID,DEFINITION_REGION_CODE,DEFINITION_DISTRICT_CODE,DEFINITION_TERRITORY_CODE,START_DATE,END_DATE)
    VALUES
    (2,299,223,334,445,'1-JUL-2011','20-JUL-2011')
    INSERT INTO ROSTER
    (ROSTER_EMPLOYEE_DEF_ID,EMPLOYEE_ID,DEFINITION_REGION_CODE,DEFINITION_DISTRICT_CODE,DEFINITION_TERRITORY_CODE,START_DATE,END_DATE)
    VALUES
    (3,299,224,335,446,'1-AUG-2011','30-AUG-2011')
    INSERT INTO ROSTER
    (ROSTER_EMPLOYEE_DEF_ID,EMPLOYEE_ID,DEFINITION_REGION_CODE,DEFINITION_DISTRICT_CODE,DEFINITION_TERRITORY_CODE,START_DATE,END_DATE)
    VALUES
    (4,300,500,400,300,'1-JUN-2011','20-JUN-2011')
    INSERT INTO ROSTER
    (ROSTER_EMPLOYEE_DEF_ID,EMPLOYEE_ID,DEFINITION_REGION_CODE,DEFINITION_DISTRICT_CODE,DEFINITION_TERRITORY_CODE,START_DATE,END_DATE)
    VALUES
    (5,300,501,401,301,'1-JUL-2011','20-JUL-2011')
    In the above table we have columns like
    EMPLOYEE_ID,DEFINITION_REGION_CODE,DEFINITION_DISTRICT_CODE,DEFINITION_TERRITORY_CODE,START_DATE,END_DATE
    The result i am looking from the above table is based on the EMPLOYEE_ID OF START_DATE AND END_DATE
    I need to get OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_CODE
    Similarly OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_REGION_CODE
    and OLD_DEFINITION_TERRITORY_CODE and the NEW_DEFINITION_TERRITORY_CODE
    I need to get one row of data for each employee saying old value and new value
    for employee 299 there are 3 records it must give the new record which is the latest date i.e start date 1-aug-2011 and end date 30-aug-2011 old record will be
    start date 1-jul-2011 and 20-jul-2011
    For the above table data i need to get the data as below
    EMPLOYEE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_CODE OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE START_DATE END_DATE
    299 223 224 334 335 20-JUL-11 30-AUG-11
    300 500 501 400 401 20-JUN-11 20-JUL-11
    Please suggest me to get the above result based on the data. Please let me know if my posts are not clear
    Thanks
    Sudhir

    SELECT  EMPLOYEE_ID,
            OLD_DEFINITION_REGION_CODE,
            NEW_DEFINITION_REGION_CODE,
            OLD_DEFINITION_DISTRICT_CODE,
            NEW_DEFINITION_DISTRICT_CODE,
            OLD_DEFINITION_TERRITORY_CODE,
            NEW_DEFINITION_TERRITORY_CODE,
            START_DATE,
            END_DATE
      FROM  (
             SELECT  EMPLOYEE_ID,
                     ROW_NUMBER() OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE DESC) RN,
                     LAG(DEFINITION_REGION_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_REGION_CODE,
                     DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE,
                     LAG(DEFINITION_DISTRICT_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_DISTRICT_CODE,
                     DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE,
                     LAG(DEFINITION_TERRITORY_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_TERRITORY_CODE,
                     DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE,
                     LAG(END_DATE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) START_DATE,
                     END_DATE
               FROM  ROSTER
      WHERE RN = 1
    EMPLOYEE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE OLD_DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE OLD_DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE START_DAT END_DATE
            299                        223                        224                          334                          335                           445                           446 20-JUL-11 30-AUG-11
            300                        500                        501                          400                          401                           300                           301 20-JUN-11 20-JUL-11
    SQL>  SY.

  • Getting hex value and coordinates of pixel

    Gud day! I just want to ask if getting the hexadecimal value and coordinates of the pixel are possible? Is there a class than can do this?

    Some things are not clear yet. Do you want to access a pixel from the screen or from an image? If image: what kind of image are you working with - BufferedImage? With "value" do you mean the RGB(A) value of the pixel? About coordinates: Usually you need to know the coordinates of the pixel you want to access.
    Assuming you have a BufferedImage and want to get the RGB value of - say - the pixel at (10,15) and display that value as a hex string:
    BufferedImage bufferedImage = ...
    int x = 10;
    int y = 15;
    int rgb = bufferedImage.getRGB(x, y);
    System.out.println(String.format("0x%08x", rgb));

  • HT203167 my brother passed away in jan.i had his ipods which were stolen from my car. they were only synced to his computer. we no longer have that computer.i know his apple id & password. can i get this much and put on new ipod?

       i had by brothers ipods and they were stolen from my car.  he passed away in january and his music was very important to me. they were only synced to his computer and we no longer have that.  i know his apple id and password. can i still access all of his library and put onto new ipod? how?
    thanks!

        @farmwife25
    After reading your post, I can certainly understand your concerns with this situation.  I would love to assist you finding a resolution for your service issues in your home area.  First, I'll need to ask you a few questions to help me in resolving.
    In what zip code do you experience this problem?  You mentioned service problems at your home.  Do you get a signal when you're outside at this location?  Have you spoken with our Technical Support Team regarding this issue in the past?  And if so, was a resolution ticket filed for this issue on your behalf?  Please let me know so that I can further assist.  Thanks!
    AnthonyTa_VZW
    Follow us on Twitter @VZWSupport

  • Get the  value and pass it to child jsp page

    Hi All,
    I want to get the attribute value from the adf table in my parent jsp page and again send it to the child jsp page.I'm very new to adf.Please any body give me a example for this.Please help me.
    Thanks in advance!

    Sorry......
    I'm using Jdeveloper 11.1.1.5 version.In my adf application i have two jsp pages.One is parent.jspx and another one is child.jspx.In my parent.jspx page i have adf table.Now i want to get the attribute value from adf table which is in parent.jspx page and i want to send that values to the child.jspx page.How can i do this.Please give me the example.
    Thanks!

  • Get Javascript values and use them in a servlet?

    Hey
    I have a HTML which has Javascript scripts which I have to get values from (a array to be exact) and pass them to a servlet so I can process the information in a certain way. I cant seem to find a way to do this properly as the servlet is server side and Javascript is client side. How can I implement this?
    Using a quick example example I have
    C:/index.html
    C:/js/script.js
    Index.html contains:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script type="text/javascript" src="js/script.js">
    </script>
    </head>
    <body>
    a href="javascript:void(0);" id="add"><img src="images/menunew.png" alt="plus" border="0" />
    /a>
    </body>
    </html>
    Script.js contains:
    var Script = Class.create({
    a:4,
    b:5,
    add: function(){       
    return (this.a + this.b);
    (Ignore syntaxis errors as this is a quick example I wrote up just to see if you can give me a practical example on how to read it.)
    How can from a Java servlet access a and b from the script.js file (which contains a class named Script) and also access the function add which returns that value?
    Thank you for the help
    Edited by: 902756 on 16-dic-2011 0:18

    DrClap wrote:
    902756 wrote:
    1: Yes, it seems like the logically answer but Im not too up on AJAX and even less on mixing it up with servlets. Do you mind giving me a simple add (function) sample or something similar?You are looking at it the wrong way. What you actually want to do is to have the browser send a request (which somehow contains that Javascript data) to a URL which causes the servlet to receive the data. There's no "mixing it up" going on there. The client and the server are entirely separate.
    And since that request would be an HTTP request, it's just text. There's no concept in HTTP of transmitting objects, whether they be Javascript objects or Java objects. Anything you want to transmit has to be converted into text by the sender and converted back into objects by the receiver.
    So there's no such thing as "a simple add function". You're going to have to stop thinking in that way and start thinking of client-server systems in the way they actually are.The thing is I want to start simple to grab a simple concept....
    Im trying a AJAX route and I have the following:
    /index.html
    /js/Adding.js
    Index contains:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
         <title></title>
         <script type="text/javascript" src="js/Adding.js"></script>
    </head>
    <body>
    <select name="num1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </select>
    <select name="num2">
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    </select>
    <form method="get" name="adding">
    Do
    <span id="res"></span>
    </form>
    </body>
    </html>
    Adding.js contains
    var Adding = Class.create({
    x: null,
    y: null,
    add: function()
         var xmlHttp = new XMLHttpRequest();
         var value1 = document.getElementById("num1").value;
    var value2 = document.getElementById("num2").value;
         xmlHttp.open("GET", "index.html", false);
         xmlHttp.send(value1 + value2);
         var result = document.getElementById("res");
         result.innerHTML = xmlHttp.responseText;
    This shows 2 comboboxes full of numbers and link saying "Do" which calls the javascript function and adds the two numbers in the comboboxs and shows them on the screen without refreshing the page. This does not work and I would like this to work before I continue onto the bigger picture.

  • Use VO to get DB value and set attribute

    Hi,
    I am working a page to create new order. I need some information populate. This is my code, which somehow not work
    public void createOrder() //(String[] args)
    OAViewObject vo = (OAViewObject)getxxMobileOrderVO1();
    if (!vo.isPreparedForExecution())
    vo.executeQuery();
    Row row = vo.createRow();
    vo.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    // Populate support information
    xxMobileSupportVOImpl sptVo = (xxMobileSupportVOImpl)getxxMobileSupportVO1();
    if (sptVo == null)
    MessageToken[] errTokens = {new MessageToken("OBJECT_NAME", "xxMobileSupportVO1")};
    throw new OAException("PER", "XXBOL_OAF_OBJECT_NOT_FOUND", errTokens);
    sptVo.initSupport();
    Row sptRow = sptVo.getCurrentRow();
    if (sptRow != null) {
    row.setAttribute("SupportPersonId", sptRow.getAttribute("PersonId"));
    row.setAttribute("SptName", sptRow.getAttribute("FullName"));
    row.setAttribute("SptEmail", sptRow.getAttribute("EmailAddress"));
    The VO xxMobileSupportVO is a simple select returns one records:
    SELECT ppx.person_id
    , ppx.employee_number
    , ppx.full_name
    , ppx.email_address
    --, lk.tag
    FROM fnd_lookup_values lk
    , per_people_x ppx
    WHERE lk.lookup_type = 'XXXX'
    AND lk.lookup_code = ppx.employee_number
    AND lk.enabled_flag = 'Y'
    AND lk.LANGUAGE = USERENV('LANG')
    AND lk.tag =
    ( SELECT MAX(NVL(tag, 0))
    FROM fnd_lookup_values
    WHERE lookup_type = 'XXXX'
    AND TRUNC(SYSDATE) BETWEEN lk.start_date_active
    AND NVL(lk.end_date_active, hr_general.END_OF_TIME)
    The VO is correctly attached to AM. I use Test feature to be sure it does get value.
    However, when the page is opened and createOrder method is called. The field does not get value populated.
    Does anyone can tell what is the issue?
    Thanks in advance.
    Rudoph

    Are you executing the VO query?
    I suppose you are executing it in sptVo.initSupport();
    If not first execute the VO using sptVo.executeQuery()
    After executing the query, do sptVO.first().
    This will give you the row of the VO.
    Then do your work based on that.
    Regards,
    Peddi.

Maybe you are looking for

  • W530, questions about adding additional RAM

    My current setup came with the factory optional 2x 8gb Samsung DDR3 1600mhz RAM. I recently purchased gskill ripjaws 8gb stick ( 1.35V model). My computer recognizes the ram is installed however mentions that the new ram is unusable.  I have the i7-3

  • After effects crashing after enabling 3D switch

    Hi All, I am running the latest CC suite and updated after effects a few days ago. I have now tried to do some simple 3D text by extruding them. Using the ray traced renderer and as soon as I click the switch for enable 3D on the text layer it crashe

  • Empty line at the end of  SAP Java instance profile

    I saw this today in help.sap.com, which says that an Java instance profile must have an empty line at the end of the file, would anyone know what is it for ? The instance profile (/usr/sap/<SID>/SYS/profile/<SID>_<instance name>_<hostname>) u2013 thi

  • Problem with band names that start by "the"

    Since upgrading my iTunes to a newer version, it put all band names which start by "THE" (like for example "The Hives, The Beatles)into the "T"-Category!!! I just want it to put it in the right order again without deleting all these "The" letters fro

  • My album artwork doesnt Match the song.

    The Album Artwork on my phone got all screwed up so now it will show a different artisits album artwork when im playing a song and was just wondering if there is a way to make it match again, all the artwork matches on my computer.