Passing values to jsp from html..

Hi all,
I have a jsp containing a selection list and need to pass the value to the java segment of the jsp. When reserching this, I've found some info where an html page was created, an initial jsp was saving the info (or bean was used) and then a third jsp displayed the data (using buttons). This is too many steps and I'm needing a way for the same jsp to display containing the selected option (simulating a refresh with the post when the drop down list is used). Is redirecting while setting and getting attributes all at once feasible/possible or is there a better direction or work around for this?
Thanks in advance,
Geoff-

I would think submitting the page to itself, and setting hidden fields to signal that it is a resubmission, may be the way to go. If the new information being displayed is minimal, JavaScript may also work, by setting up an empty <div> or <span> and setting the innerHTML or innerText properties. The advantage of the JavaScript solution is it would be quicker, having the client do all the processing, but it also browser dependant.

Similar Messages

  • How to passing value into Captivate from html?

    How to passing value into Captivate from html?
    Or
    How to communicate between objects in one slides?

    Hi czhao0378 and welcome to the forums!
    Captivate does not natively allow you to communicate your own
    data, either internally or externally. The only way to make this
    happen is to create your own functionality, either via custom-built
    Flash objects or JavaScript code executed in the browser or a
    combination of both.
    The only example I've seen of any "data passing" inside
    Captivate is a custom text input/output solution that was posted on
    the Captivate Developer Exchange:
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1253 021
    This solution consists of an input box that takes information
    from the user on one slide and a second box that displays that
    information on another slide. The functionality was built in Flash
    and is embedded in Captivate as a Flash "animation". Unfortunately,
    since this is a custom functionality, the information is not
    included in the user completion results Captivate can pass to a
    Learning Management System.
    Since the solution mentioned above relies on a Flash
    Actionscript variable to hold the information that is displayed,
    you can also pass the information from HTML to Captivate using the
    "SetVariable" command in JavaScript. This would at least allow you
    to display your own HTML-based data inside Captivate.
    Beyond that, I'm not aware of any other way to gather and
    pass data in Captivate.

  • Pass data to JSP from HTML?

    I can pass the data in a HTML form without problem if the form is in the same jsp file. I have no problem to pass data from one jsp file to another one. But when the jsp file has to take the data passed from calling HTML file and has to receive the data from the same jsp file, then the data from other HTML file will be null the first time runing the code, then second time will be passed right. If I shut down computer run the code again, same problem until the second time. Please tell me why if any of you know!

    yes. The first part is HTML file which use the form to pass v_progname, the second part is a jsp file, it suppose to get the data in v_prgname, but the first time to run this code always get null, then the second time get the right data?
    <html> <head> <title>CTI</title>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> </head>
    <body bgcolor="#FFFFFF"> <form name="theForm" enctype="text/html" method="post"
    action="http://titan.ssd.loral.com:7778/ifs/jsp-bin/ifs-cts/jsps/uploadfilehome.jsp">
    <table border="1" cellspacing="0" cellpadding="4">
    <tr> <td bgcolor="#FFFFEE"><font face="Arial, Helvetica,sans-serif" size="2"> Communication racking Item </font></td> <td colspan="5"><font face="Arial, Helvetica, sans-serif"size="2">SATMEX-6-2 </td>
    <input type="hidden" name="v_sidname"value="/expctl/dev//comm_tracking.edit_document">
    <input type="hidden" name="v_schema"value="migra2">
    <input type="hidden" name="v_cti_number"value="SATMEX-6-2">
    <input type="hidden" name="v_progname"value="satmex-8">
    <input type="hidden" name="v_doc_id"value="5131"> </tr> </table><br>
    <input type="submit" value="Upload Document">     
    <input type="reset" value="Reset"></form></body></html>
    uploadfilehome.jsp as following:
    <html><head>
    <%
    String v_program=request.getParameter("v_progname");//this is the parameter passed from html file, //with a problem?
    WebUILogin login = WebUILogin.getWebUILogin( request );
    String step = WebUIUtils.getUTF8Parameter(request,"step");
    //String path=WebUIUtils.getUTF8Parameter(request,"path");
    String path="/home/scott/satmex-6";
    String windowID=WebUIUtils.getNewWindowID();
    %>
    <SCRIPT LANGUAGE="JavaScript1.2">
    var path="<%=path%>";
    var jsWindowID="<%=windowID%>";
    </script>
    <%
    if ( null == step )
    step = "get";
    %>
    <SCRIPT LANGUAGE="JavaScript">
    function AutoLogin() {
    document.loginform.userName.value == "scott";
    document.loginform.passWord.value == "tiger";
    document.loginform.submit();
    function PkeyPress(event)
    if (document.layers)
    if (event.which==13)
    document.loginform.submit();
    else {
    if (window.event.keyCode==13)
    document.loginform.submit();
    </SCRIPT>
    <%
    if ( step.equals("try") )
    login.processRequest(request);
    %>
    <SCRIPT LANGUAGE="JavaScript1.2">
    window.location='../jsps/uploadhome.jsp?path='+path+'&windowID='+jsWindowID;
    </script>
    <%
    // check to see if we have already logged in before...
    if ( null != login.getSession() )
    %>
    <SCRIPT LANGUAGE="JavaScript1.2">
    window.location='../jsps/uploadhome.jsp?path='+path+'&windowID='+jsWindowID;
    </script>
    <%
    else
    %>
    <title><%=login.getJspResourceString(JspResourcesID.LOGIN_TITLE)%></title>
    </head>
    <body bgcolor="#FFFFFF" onLoad="AutoLogin();" onResize="return false;">
    <form METHOD=POST NAME="loginform" ACTION="uploadfilehome.jsp">
    <INPUT TYPE="hidden" NAME="userName" VALUE="scott">
    <INPUT TYPE="hidden" NAME="passWord" VALUE="tiger" onKeyPress="PkeyPress(event);">
    <INPUT TYPE="hidden" NAME="step" VALUE="try">
    <INPUT TYPE="hidden" NAME="action" VALUE="Login">
    </form>
    </body>
    </html>
    <%
    %>

  • Passing values to JSP using HTML

    I have 2 jsp�s (First.jsp, second.jsp).
    I have one a:href on First.jsp where it goes to Second.jsp , and also it needs to take some ID values from First.jsp to Second.jsp.
    Below is my code (First.jsp):
    <h:inputHidden id =�employeeId� value = �#{employee.employeeID}�
    <h:inputHidden id =�applicationId� value = �#{employee.appliationID}�
    Below iy my href:
    <a href = �/jsp/Second.jsp� > Add Application </a>
    How can I send values of employeeId and applicationID to Second.jsp , on clicking Add Application on first.jsp
    Any suggestions

    That's JSF.
    You may find this article useful: http://balusc.xs4all.nl/srv/dev-jep-com.html

  • 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

  • Passing values to javascript from database

    hi friends,
    I have to fetch values from the database and pass the values to the java script variable.
    I tried this, but is not working. When i place the script inside the java, it isnt working. Iam passing value to this script variable as argument to a function. This is my code:
    ResultSetMetaData rsmd = rs.getMetaData();
    int numberOfColumns = rsmd.getColumnCount();
    while (rs.next())
    for (int i = 1; i <= numberOfColumns; i++)
    count=count+1;
    if (i > 1)
    columnValue = rs.getString(i);
    %>
    <script>
    var hcbList = [<%=request.getParameter("columnValue")%>];
    </script>     
    <%           
    System.out.println("");
    st.close();
    %>
    Pls solve the problem. Its very urgent!
    thanx

    Keep this in mind: JSP is source generation software.
    In other words JSP generates the HTML and/or Javascript that will be rendered on the browser. So What you need to do is keep the JSP and Javascript separate in your mental picture. You ask yourself, "what would the finished Javascript code look like that would give me the results?" Then you apply JSP as a template to fill in the blanks. In your example you want a list or an array of values in your Javascript. I don't use Javascript to often but from memory I belive an array in Javascript is something like this:
    <script>
    var hcbList = {"val1", "val2, "valx"};
    </script>That's what the finished Javascript would look like. Now you apply JSP as a template.
    <!-- This is the fill-in-the-blank template
    <script>
    var hcbList = {<%=insertArrayHere%>};
    </script>Now you fill in the blanks
    //insertArrayHere is your blank
    String insertArrayHere = "";
    //iterate over the collection and build a string that represents the JS array
    for(int i = 1; i <= numberOfColumns; i++)
       //wrap each value with quotes if it is to be a JS string
       insertArrayHere += "\"" + rs.getString(i) + "\"" + ","; //terminate with a comma
    //trim the last comma off the array guts
    insertArrayHere = insertArrayHere.substring(0, insertArrayHere.length() - 1); Now I'm sure that's not exactly what you want because it looks like you got some crazyness going on in your logic. I don't know how you can query the using values from the database. Anyhow it poses as a good example of how to apply the concept of the two technologies. (Also, why are you doing a System.out from JSP? You should be calling log() if you want console output.) The whole idea is that JSP can NOT talk directly to Javascript. It can only generate Javascript dynamically before it is received by the browser.

  • Passing vectors into JSP from Servlet and passing data back to Servlet

    I have been building an MVC application.
    It has a controller which instantiates classes and evokes methods to
    populate vectors. These vectors are then passed into a JSP. This part of the application works fine.
    What I am having trouble with is a new JSP I have designed; this will
    display the data that is actioned by the FORM action. This is actioned
    based on the Search criteria entered by the user. Based on this a further vector is populated and brought back to the JSP as a vector
    and this is rendered via the TABLE tag. Again this works fine.
    Against each of the rows displayed, I have a print checkbox which can be checked by the user. On checking the records they want to print, they should then hint a Print button which should go back to the Servlet and print the data. THIS IS WHERE I HAVE THE PROBLEM. On going
    back to the servlet the checkbox values are not displayed, rather
    the values that initially populate the JSP. How do I get these new values back into the vector and hence accessible from the Servlet.
    Any help with be very much appreciated.
    Chris

    Thanks for this.
    Just to clarify I am not using Struts.
    What I am having difficulties with is the fact that:
    I can't get the checked values back to the Servlet - they keep the values they have in the bean - so as part of instantiating the bean class I set the value of the item to 'off'. The user will then check
    the checkbox which should presumbably set the value to 'on'. This isn't happening because the setter method of the bean is not evoked again
    because I don't come into this JSP again - the Servlet has finished here
    and now needs to print the records. It can't do this because as
    far as it is concerned nothing has changed since it last passed through
    the vector to the JSP.
    Even when I do the following:
    Enumeration paramNames = request.getParameterNames();
    String param = null;
    while (paramNames.hasMoreElements())
    param=(String)paramNames.nextElement();
    System.out.println("parameter " + param + " is " +
    request.getParameter(param));
    what comes back is the valus of 'off' as opposed to 'on'.
    The other thing is that 'request.getParameterNames()' only works
    with the first record in the vector, i.e. it doesn't fetch any other
    records that are rendered in the <TABLE> tag.
    In desperation is there anybody out there who can help me.
    Thanks
    Chris
    I am going to assume you are using a MVC framework
    like Struts or very similar (I am assuming that from
    the language you are using).
    When the servlet passes the vector back to the JSP
    page and you render the HTML that is passed back the
    client your Vector is gone. The Vector is not
    available at the HTML level that is being viewed at
    the browser.
    When the user selects the checkboxes and submits the
    page (by clicking the print button) the controller
    servlet (called ActionServlet in Struts, yours maybe
    called something else) forwards the request to the
    appropriate JavaBean and Servlet to process the
    request. Either the JavaBean has to recreate the
    Vector (not recommended) or the processing Servlet can
    (better). You can do this by recreating the Vector
    from scratch for the HttpRequest parameters or, at the
    time of the initial request, saving Vector to a
    session and then updating with the data you get back
    from the client (again from the HttpRequest
    parameters).
    Either way you have to work with
    HttpRequest.getParameter().

  • 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.

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

  • Passing values in jsp.

    String[] numbername ={"1","2","3"};
    String numval[] = new String[3];
    for(int j=0; j<names.length; j++){ %>
    <TR><TD BGCOLOR=666699 ALIGN=CENTER><b><%=j+1%>.</b></TD>
              <TD BGCOLOR=AAAAAA ALIGN=CENTER> <font class="name"><%=names[j]%></font> </TD>
              <TD BGCOLOR=AAAAAA ALIGN=CENTER width="9%"><font class="cname"><%=Cnames[j]%></font></TD>
    <TD BGCOLOR=AAAAAA ALIGN=CENTER><font class="description"><%=SKUs[j]%></font></TD>
    <TD BGCOLOR=AAAAAA ALIGN=CENTER>Squab </TD>
    <TD BGCOLOR=AAAAAA ALIGN=CENTER><b>$<%=prices[j]%>0</b></TD><!--value=shoppingCart.setQty(Integer.parseInt(numval[j]))%>-->
              <TD BGCOLOR=AAAAAA ALIGN=CENTER><input type="text" name=<%=numbername[j]%> size="2" > </TD>
    <TD BGCOLOR=cccc66>
    <br><a href="squab1.jsp?name=<%=names[j%">&cname=<%=Cnames[j]%>&sku=<%=SKUs[j]%>&price=<%=prices[j]%>&numname=<%=numbername[j]%>">
    Add</A></TD></TR>
    <% } %>
    This is a part of my code for a shoppingcart. I have been trying to get the value from the text box which is the quantity for this cart. - <input type="text" name=<%=numbername[j]%> size="2" > But the values are static from this page. When I enter the values from the page, it did not give the values i enter instead the static values appears. Can anyone know a way to get the value as entered in this for loops? Please help by take a look at this jsp code above. I have been trying many ways in many days but no answere. Can anyone help?
    </a>

    <HTML><HEAD><TITLE>Squab</TITLE>
    <%@ page contentType="text/html; charset=Big5"%>
    <%@ include file="411.css" %>
    <%@ page language="java" import="myclasses.*" %>
    <jsp:useBean id="shoppingCart" class="myclasses.ShoppingCarts1" scope="session"/>
    <%@ page import="java.util.*" %>
    </HEAD><BODY BGCOLOR=D1D1D1>
    <H2 align="center"> MENU ����</H2>
    <TABLE width="100%" cellspacing="0" ><TR>
    <TD BGCOLOR=999966 ALIGN=CENTER>Appetizers �Y�i  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Soup ����  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Abalone �j��  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Lobster �s��  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Shrimp ��  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Crab ��  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Fish ��  </TD>
    </TR></TABLE>
    <TABLE width="100%" cellspacing="0" cellpadding="2"><TH height="2"><TR >
    <TD BGCOLOR=999966 ALIGN=CENTER>Scallops �a�l  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Oysters ����  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Clams ����  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Squid �A�{  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER><A HREF="duck.jsp">Duck �n</A>  </TD>
    <TD BGCOLOR=666699 ALIGN=CENTER> Squab �F  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER><A HREF="pork.jsp">Pork ��</A>  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER><A HREF="beef.jsp">Beef ��</A>  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Chicken ��  </TD>
    </TR></TH></TABLE>
    <TABLE width="100%" cellspacing="0"><TH height="2"><TR>
    <TD BGCOLOR=999966 ALIGN=CENTER>Vegetarian ������  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Cantonese Clay Pot �s�J��  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Mu-Shu ������  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Noodles ����,����  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Fried Rice ������  </TD>
    <TD BGCOLOR=999966 ALIGN=CENTER>Family Dinners  </TD>
    </TR></TH></TABLE>
    <hr size="3">
    <H2 align="left"> Squab �F</H2>
    <FORM ACTION=ViewCart1.jsp METHOD=get>
    <TABLE width="100%">
    <b><p align="right">View Orders</p></b>
    <TR><TD BGCOLOR=666699 ALIGN=CENTER><font class="Label">Items</font></TD>
         <TD BGCOLOR=666699 ALIGN=CENTER colspan="2"><font class="Label">Name</font></TD>
         <TD BGCOLOR=666699 ALIGN=CENTER><b>Decription</b></TD>
    <TD BGCOLOR=666699 ALIGN=CENTER><b>Catagory</b></TD>
         <TD BGCOLOR=666699 ALIGN=CENTER><b>Price</b></TD>
         <TD BGCOLOR=666699 ALIGN=CENTER><b>Qty</b></TD>
    <TD BGCOLOR=666699 ALIGN=CENTER> </TD></TR>
    <% String[] names = {"CRISPY BRAISED SQUAB","SOY SAUCE SQUAB","PAN FRIED MINCED SQUAB WITH LETTUCE"};
    String[] SKUs = {"Squab marinated in five spice seasoning and roasted to prefection.","Whole squab braised with supreme soy sauce.","Stir fried minced squab with ground water chestnuts, Chinese sausage, Chinese mushrooms and served with fresh lettuce cups and hoi sin sauce." };
    String[] Cnames ={"�����N���F","���o�����F","�������F�]"};
    double[] prices = {12.00, 12.00, 12.00};
    String[] numbername ={"1","1","1"};
    String numval[] = new String[3];
    for(int j=0; j<names.length; j++){ %>
    <TR><TD BGCOLOR=666699 ALIGN=CENTER><b><%=j+1%>.</b></TD>
              <TD BGCOLOR=AAAAAA ALIGN=CENTER> <font class="name"><%=names[j]%></font> </TD>
              <TD BGCOLOR=AAAAAA ALIGN=CENTER width="9%"><font class="cname"><%=Cnames[j]%></font></TD>
    <TD BGCOLOR=AAAAAA ALIGN=CENTER><font class="description"><%=SKUs[j]%></font></TD>
    <TD BGCOLOR=AAAAAA ALIGN=CENTER>Squab �F </TD>
    <TD BGCOLOR=AAAAAA ALIGN=CENTER><b>$<%=prices[j]%>0</b></TD><!--value=shoppingCart.setQty(Integer.parseInt(numval[j]))%>-->
              <TD BGCOLOR=AAAAAA ALIGN=CENTER><input type="text" name=<%=numbername[j]%> size="2" > </TD>
    <TD BGCOLOR=cccc66>
    <br><a href="squab1.jsp?name=<%=names[j%">&cname=<%=Cnames[j]%>&sku=<%=SKUs[j]%>&price=<%=prices[j]%>&numname=<%=numbername[j]%>">
    Add</A></TD></TR>
    <% } %>
         <TR><TD BGCOLOR=666699 ALIGN=CENTER>  </TD>
              <TD BGCOLOR=666699 ALIGN=CENTER colspan="2">  </TD>
         <TD BGCOLOR=666699 ALIGN=CENTER>  </TD>
         <TD BGCOLOR=666699 ALIGN=CENTER>  </TD>
              <TD BGCOLOR=666699 ALIGN=CENTER>  </TD>
              <TD BGCOLOR=666699 ALIGN=CENTER>  </TD>
              <TD BGCOLOR=666699 ALIGN=CENTER>  </TD>
    </TR>
    </TABLE>
    <b> <p align="center"><input type="submit" name="submit" value="View Orders"></p></b>
    <%
    String name = request.getParameter("name");
    String cname = request.getParameter("cname");
         if(name!=null){
    if(name.equals("emptyCart")){
    shoppingCart.emptyCart();
    } else {
    String sku = request.getParameter("sku");
    double price = Double.parseDouble(request.getParameter("price"));
         int qty = Integer.parseInt(request.getParameter( "numname"));
         shoppingCart.setQty(qty);
    ShoppingCarts1 newItem = new ShoppingCarts1(sku, name,cname, "Squab", price);
    shoppingCart.addItem(newItem);
    }} %>
         </FORM></BODY></HTML>
    Here is the code that I am using. The only problem is that when I entered the quantity of the order , it did not take my entered number instead the static integer I assigned earlier; String[] numbername ={"1","1","1"}; located in the middle of this code. See I have to assign all quantity to 1 to all the products initially. But If some one want more than one, that person has to type the number on the text box. How can I retrieve that number instead of one. I generate all the numbers inside of the for loop. Please take a closer look at the middle part of the assigned code. Very urgent, thanks ahead.
    </a>

  • Servlet passing values to JSP and ClasscastException

    I am using weblogic 5.1 to run my Servlets.
              I want to know when I forward from a servlet to a JSP how do I pass
              values especially Java Objects (Sometimes Objects of User written Java
              classes).
              Uptil now I have been putting all values in the session from where the
              JSP picks them up, but somehow I have a feeling that this is not the
              right way.
              In a code I am putting a Java Object (It contains two attributes of
              Java.util.Vector type) in the session so that the JSP to which I am
              forwarding it to can use it I have put my class in the ServletClasses.
              Intertestingly it runs well till the contents of the Vector are changed.
              As the contents of the vector are changed, it throws ClassCastException
              The StackTrace is as follows:
              java.lang.ClassCastException
              at
              jsp_servlet._select_95_account_95_profile._jspService(_select_95_account_95_pro
              file.java, Compiled Code)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java, Compiled
              Code)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
              C
              ompiled Code)
              at
              weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
              ava:143)
              at
              com.logistics.optistopasp.servlet.AccountSelectServlet.doPost(AccountSelectServ
              let.java, Compiled Code)
              at
              com.logistics.optistopasp.servlet.AccountSelectServlet.doGet(AccountSelectServl
              et.java:35)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
              C
              ompiled Code)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
              ava, Compiled Code)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
              ava, Compiled Code)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextMan
              ager.java, Compiled Code)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,
              Compile
              d Code)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
              Compiled Code
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
              Compiled Code)
              Can anybody please Help!!!!.
              Thanks
              Pankaj
              

    Only can confirm your finding - the jsp is using a different class loader to the servlet that originally instantiated the object. There's the rub. I haven't figured out yet how to fix that. I can get the classloader but don't know how to get the runtime to use that class loader to perform cast.
              

  • Servlet passing Values to JSP

    I want to know when I forward from a servlet to a JSP how do I pass
              values especially Java Objects (Sometimes Objects of User written Java
              classes).
              Uptil now I have been putting all values in the session from where the
              JSP picks them up, but somehow I have a feeling that this is not the
              right way.
              Suppose my servlet is forwarding to a jsp . What should it do in case an
              exception happens in the servlet and wants to forward it to the jsp.
              Putting the Exception object in the session is an alternative but I
              wonder that is the best approach.
              If someone knows a better way od doing it, please help.
              Pankaj
              

    You could probably use setAttribute
              ..before forwarding the control to JSP.
              req.setAttribute("message", "Hello, world");
              ServletContext app = getServletContext();
              RequestDispatcher disp;
              disp = app.getRequestDispatcher("Dispmessage.jsp");
              Cheers,
              Naggi
              pankaj wrote:
              > I want to know when I forward from a servlet to a JSP how do I pass
              > values especially Java Objects (Sometimes Objects of User written Java
              > classes).
              > Uptil now I have been putting all values in the session from where the
              > JSP picks them up, but somehow I have a feeling that this is not the
              > right way.
              > Suppose my servlet is forwarding to a jsp . What should it do in case an
              > exception happens in the servlet and wants to forward it to the jsp.
              > Putting the Exception object in the session is an alternative but I
              > wonder that is the best approach.
              > If someone knows a better way od doing it, please help.
              >
              > Pankaj
              

  • Passing values to Jframe from JApplet

    Hi All,
    i need to open a frame when someone clicks on some particular part of an applet. also, i need to pass some values to that frame based on the region selected.
    Previusly i m doing it through showDocument method which calls a JSP which in turn calls the applet that i m trying to change as a frame now.
    Help please.
    Liza

    just to make things more clearer... i was passing values as querystring to JSP which passes them to an applet through parameter tags.
    Liza

  • Passing values between JSP and Bean

    I am trying to validate a date entered by the user on a form. I need to do an "alert" when the user enters a date outside of the valid range depending on a value entered in a drop down.
    Am doing this in checkform function. Here is what I want to do:
    1. Send the the value from the drop down and the date to bean to do the calculations. Call the EJB function from checkform.
    2. Get a string values back into the jsp from the bean
    3. Blow an error to the user to enter a valid date.
    Any help in this case would be greatly appreciated.
    Thanks.

    I only see some design requirements.
    What's the exact coding question? Where are you stucking while coding those requirements accordingly?

Maybe you are looking for

  • G5 Logic Board or Memory Issues?

    Hello, about 2 months ago i recieved a 1GB Dimm for christmas, and being naive, i installed it in the slot above the 4 512MB RAMs that came with my computer. When the computer didnt recognize it i looked in the manual and found out that you are suppo

  • JDeveloper 10g video problems with Windows Vista

    Hi, I'm using JDev 10g 10.1.3.3 over Windows Vista with Aero active. Since I started using Vista, I have always had problems with JDev. First, the fonts in the JDev panels would mess up and the scrolling would not work well. I made some changes in th

  • How to append poi excel files?

    Hi All, I am using POI excel files and this is my code to create an excel sheet. for(i=0;i<i<files.length();i++) String excel=excelFiles[i] Date date=  new Date();   int  rowCount= 45; Sample samp=new Sample(); samp.createWorkbookForLogReport(excel,d

  • HT5373 My iPad calendar only retains a few months history even though I have it set for all entries. All my 2013 dates disappeared?

    My iPad calendar dropped all my prior year 2013, dates which I need fir reference purposes. I have my calendar set to retain all dates. What's wrong?

  • Airport Extreme + Netgear DG834PN

    Hi, I've got a Netgear DG834PN ADSL router I use to connect to my broadband, and currently run ethernet from that to my Airport Extreme (802.11n but not the latest one) which I then connect to wirelessly from my iMac + Macbook. The Netgear is in one