How to display array

Hi, I have a problem to display array from my database. The following are the two files that I tried to input multiple values in mailaddress database in the second file and I tried to display the values from the database when the user login the first file. The values are recorded in the database well but I always got java.lang.NullPointerException error in my first file. I checked the code, it shows that array display wrong. Would you please help me? Thanks a lot in advance.
<zhangmailinputtest.jsp>
<%@ page language="java" contentType="text/html; charset=Shift_JIS" %>
<%@ page import="beanYama.*,java.sql.*,java.util.*,java.text.*" %>
<%@ include file="inc_conv_char.jsp" %>
<%
String uid =(String)session.getAttribute("uid");
String unam =(String)session.getAttribute("unam");
String depart =(String)session.getAttribute("depart");
String perms =(String)session.getAttribute("perms");
String flag =(String)session.getAttribute("flag");
if(flag==null){
     response.sendRedirect("index.jsp");
}else{
%>
<html>
<body>
<%!      String[] name;
     String[] departa;
     String[] email;
%>
<%
          Connection con = null;
          Statement stmt1 = null;
          ResultSet rsq = null;
          Class.forName("org.gjt.mm.mysql.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localhost/progress?user=ntjs&password=ntjs&useUnicode=true&characterEncoding=Shift_JIS");
          stmt1=con.createStatement();
     rsq=stmt1.executeQuery("SELECT name AS name1 from mailaddress;");
          if(rsq.next()){
               for (int i=0;i<name.length;i++) {
               name[i] = rsq.getString("name1");
               rsq.next();
          stmt1.close();
          con.close();     
%>
<form action="zhangmailtestfinal.jsp" method="post">
<table width="60%" border="1" cellpadding="1" cellspacing="1" bordercolor="#000099">
<tr>
<td width="20%"><div align="center">Name</div></td>
<td width="20%"><div align="center">Department</div></td>
<td width="50%"><div align="center">Address</div></td>
</tr>
<tr>
<td><input type="text" name="name" size="25" value="<%=name[0]%>" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
<tr>
<td><input type="text" name="name" size="25" align="middle"></td>
<td><input type="text" name="departa" size="25" align="middle"></td>
<td><input type="text" name="email" size="53"align="middle"></td>
</tr>
</table>
<input type="submit" name="save_button" value="Save">
</body>
</CENTER>
</html>
<%
%>
<zhangmailtestfinal.jsp>
<%@ page language="java" contentType="text/html; charset=Shift_JIS" %>
<%@ page import="beanYama.*,java.sql.*,java.util.*,java.text.*" %>
<%@ include file="inc_conv_char.jsp" %>
<%
String uid =(String)session.getAttribute("uid");
String unam =(String)session.getAttribute("unam");
String depart =(String)session.getAttribute("depart");
String perms =(String)session.getAttribute("perms");
String flag =(String)session.getAttribute("flag");
if(flag==null){
     response.sendRedirect("index.jsp");
}else{
%>
<html>
<body>
<%!
     Connection con = null;
     PreparedStatement ps = null;
     ResultSet rs = null;
%>
<%
     String[] name = request.getParameterValues("name");
     String[] departa = request.getParameterValues("departa");
     String[] email = request.getParameterValues("email");
try{          
          Class.forName("org.gjt.mm.mysql.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localhost/progress?user=ntjs&password=ntjs&useUnicode=true&characterEncoding=Shift_JIS");
          Statement stmt0=con.createStatement();
          stmt0.executeUpdate("delete from mailaddress");
          String query ="INSERT INTO mailaddress (mail_userid,name,departa,email) VALUES (?,?,?,?)";
          ps = con.prepareStatement(query);
               for (int i=0;i<name.length;i++){
               ps.setString(1,uid);
               ps.setString(2, name);
               ps.setString(3, departa[i]);
               ps.setString(4, email[i]);
               ps.addBatch();
          ps.setString(4,uid);
          int[] results = ps.executeBatch();
          Statement stmt1=con.createStatement();
          ResultSet rsq=stmt1.executeQuery("SELECT name AS name1 from mailaddress where mail_userid=" + "'" + uid + "'" + ";");
          if(rsq.next()){
               for (int i=0;i<name.length;i++) {
               name[i] = rsq.getString("name1");
               rsq.next();
} catch (Exception e) {
               throw new ServletException(e);
          } finally {
               try {
                    if(rs != null) {
                         rs.close();
                         rs = null;
                    if(con != null) {
                         con.close();
                         con = null;
               } catch (SQLException e) {}
%>
</html>
<%
%>

Where exactly is the exception being generated?
My guess is this bit here:
if(rsq.next()){
  for (int i=0;i<name.length;i++) {
    name = rsq.getString("name1");
    rsq.next();
}I don't think your name array has been initialised in this file. Plus it assumes that the name array has exactly the same number of items as the query returns. To me thats rather dubious...
I would suggest this instead
while (rsq.next()){
    name = rsq.getString("name");
}I'm still not entirely certain what you are trying to accomplish, but thats probably the cause of the null pointer.
good luck,
evnafets

Similar Messages

  • How to display array values in jsp of screen flows

    Hi,
    can u please help me .
    I am having one array variable i have stored all the values but i have to display that in JSP page .how to display
    Edited by: user12171025 on Nov 4, 2009 11:11 PM

    Hi,
    I think that its necessaries to use AJaX.
    I am implemeting something like that.
    I have a input text that works like a filter and depends on what my user types in input text I populate my table with some information.
    In order to do that, I put in my JSP a div with an Id and I used ajax, like that:
    function ajaxFunction()
              var xmlhttp;
              if (window.XMLHttpRequest)
              xmlhttp=new XMLHttpRequest();
              else if (window.ActiveXObject)
              // code for IE6, IE5
              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              else
              alert("Your browser does not support XMLHTTP!");
              xmlhttp.onreadystatechange=function()
                                                      if( xmlhttp.readyState==4 )
                                                           document.getElementById("tabelaResponsaveis").innerHTML = xmlhttp.responseText;
         var resp = "<f:invokeUrl var='solicitacao' methodName='getResponsaveis'/>";
         xmlhttp.open("POST",resp,true);
         xmlhttp.send(null);
    getResponsaveis is a method inside my BPM that returns a HTML code (the table HTML code with all the information that I need to show.
    I Hope to help
    Thanks Marcos

  • How to display array values in textfield?

    i am creating student details with mysql database using JSON to get values and display in xcode.i got json array values from php and converted to NSMuatable array. my array result
        firstName = hari;
        lastname = krishna;
        age=10;
        fathername=ragav;
        firstName = priya;
        lastname = amirtha;
        age=8;
        fathername=ravi;
    now i want to display values iwhen i am enter firstname other field values display  in  textfiled  on button click.how to do that .help me .thanks in advance.
    i am very new to xcode.

    Hi,
    I think that its necessaries to use AJaX.
    I am implemeting something like that.
    I have a input text that works like a filter and depends on what my user types in input text I populate my table with some information.
    In order to do that, I put in my JSP a div with an Id and I used ajax, like that:
    function ajaxFunction()
              var xmlhttp;
              if (window.XMLHttpRequest)
              xmlhttp=new XMLHttpRequest();
              else if (window.ActiveXObject)
              // code for IE6, IE5
              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              else
              alert("Your browser does not support XMLHTTP!");
              xmlhttp.onreadystatechange=function()
                                                      if( xmlhttp.readyState==4 )
                                                           document.getElementById("tabelaResponsaveis").innerHTML = xmlhttp.responseText;
         var resp = "<f:invokeUrl var='solicitacao' methodName='getResponsaveis'/>";
         xmlhttp.open("POST",resp,true);
         xmlhttp.send(null);
    getResponsaveis is a method inside my BPM that returns a HTML code (the table HTML code with all the information that I need to show.
    I Hope to help
    Thanks Marcos

  • How do display array of labels and buttons in JSplitPane

    Helloo
    Iam doing doing project on swing. I want to display an array of JLabels in JSplitPane. That to the leftside of the JSplitPane. On Right side Array of Jutton Please can any body solve my problem.
    regards
    sonali

    Hi Sonali,
    If u wish to add JLabel and JButton in the following manner
    label
    label
    label
    label
    why not try using GridLayout for each of the panel in the splitpane.try setting gridLayout(0,10) assuming that u have 10 labels.Then add those to the panel which is added to the SplitPane.
    Hope this gives u an idea.
    Cheers :)
    Nagaraj

  • How to display on the graph three or more waveforms where time scale is not an index of array but a real time

    How to display on the graph three or more waveforms where time scale is not an index of array but a real time:
    I measure three voltages Va, Vb, and Vc on my Test stands every 3sec. So I’m building four arrays (Va, Vb, Vc, Time) and combine all in one.
    Time
    Va
    Vb
    Vc
    0
    5
    3.5
    2.8
    3
    4.9
    3.6
    2.9
    6
    4.8
    3.8
    2.1
    Now I need to show on the graph in which scale X is “Voltage” and scale Y is “Time”.
    How can I do it?
    Thanks a lot,
    Boris

    Hi, thanks all your reply.
    You may find "points_to_bar_graph.vi" from this website, I find it by this way.
    I will ask a stupid question: I don't have any photo processing software, how can I save the vi into a picture format?
    So here I just paste it into word document.
    Attachments:
    question.doc ‏520 KB
    points_to_bar_graph.vi ‏62 KB

  • How to reverse array display order?

    Is there a way to reverse the way labview displays array data?  When using a boolean array I would like the LSB to be on the right side.
    I know that you can use the reverse array function, but that changes the actual data. I would rather just change how the data is displayed.  Also I have quite a few and don't want to have to add that to all of them.
    Thanks

    It should be fairly trivial to add a reverse array before displaying the data. Keep in mind, when you display the data on the Front Panel, you can keep a parallel branch wire on the Block Diagram that is not affected by the Reverse Array.
    Also, if you are displaying many of these arrays, perhaps you could use a 2D array on the Front Panel to show all bitmaps at once? Or, a 1D array that contains a cluster of the Boolean array if the Boolean arrays are ragged/jagged. Using this method would be scalable, meaning you would need only 1 Reverse Array for N arrays you want to display.
    And smercurio_fc is right about the XControl being able to display a reversed array. But if you're not willing to drop Reverse Array in a few places, you're probably not willing to bite off the non-trivial task of creating an XControl (there's a moderate learning curve for getting the hang of creating a good XControl).
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • How to display Image by using Array?

    Hi all, I know to how to display the image in MXML by using
    AS 3.0
    like this:
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100" height="80" borderStyle="solid">
    <mx:Script>
    <![CDATA[
    [Embed(source="logo.gif")]
    [Bindable]
    public var imgCls:Class;
    ]]>
    </mx:Script>
    <mx:Image source="{imgCls}"/>
    <!--OR-->
    <mx:Image source="@Embed('assets/Nokia_6630.png')"/>
    </mx:Application>
    But the thing is I am building a list for display the images,
    the values is come from the Array. I am trying a different way for
    display it but no working, here is my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    public var PICTURE_ARRAY:Array = [{label:"FileA",
    icon:"@Embed('upload/myjpg.jpg')"},
    {label:"FileC", icon:"@Embed('upload/myjpg.jpg')"},
    {label:"FileB", icon:"@Embed('upload/myjpg.jpg')"}]
    ]]>
    </mx:Script>
    <mx:Tile id="pictureSelection" height="180" width="500"
    borderStyle="solid">
    <mx:Repeater id="picRP"
    dataProvider="{PICTURE_ARRAY}">
    <mx:VBox horizontalAlign="center" verticalAlign="middle"
    verticalGap="0" borderStyle="none" width="100" height="100">
    <mx:Image width="80" height="80"
    source="{picRP.currentItem.icon}"
    toolTip="{picRP.currentItem.icon}"/>
    <!--
    I also tryed this as well:
    set the icon value as picture location like: "A.jpg" or
    "B.jpg"
    then
    <mx:Image width="80" height="80"
    source="@Embed('upload/{picRP.currentItem.icon}')" />
    -->
    <mx:Label text="{picRP.currentItem.label}" width="100"
    textAlign="center"/>
    </mx:VBox>
    </mx:Repeater>
    </mx:Tile>
    </mx:Application>
    Can anyone tell how to display the array value into Image
    tag? Thanks

    In your data you have this:
    {label:"FileC", icon:"@Embed('upload/myjpg.jpg')"},
    change it to this:
    {label:"FileC", icon:"upload/myjpg.jpg"}, // this is just the
    filename, not embedded
    In your Repeater you have this Image tag:
    <mx:Image width="80" height="80"
    source="{picRP.currentItem.icon}"
    toolTip="{picRP.currentItem.icon}"/>
    which is fine, except for the toolTip. The toolTip uses a
    string, not an image. If you want to show an image in the toolTip,
    you'll need to write your own toolTip class.
    Now the source property of the image will be given the URL to
    the image which will then be requested from the server and
    downloaded at runtime - it is not embedded.
    If you need to embed the images, then your dataProvider
    should have the variable name associated with the embedded
    image.

  • How to display an array in a VB form

    I am new to Measurement Studio. This could be a silly question.
    I am so used to the front panel in Labview where you can have control/indicator arrays. You can expand an array to see several values at the same time. Plus you have an index display to scroll.
    Is there any similar feature in Measurement Studio for Visual Basic or Visual C? If not, why not.
    cheers

    No, there isn't currently a tabular or array control provided with Measurement Studio. There are a few reasons for this. First off, remember, LabVIEW is a graphical language, there isn't anything that isn't a control or indicator on a front panel. The array control in LabVIEW is mainly there as the datatype for arrays, not specifically as a UI object, although it is frequently used that way.
    In Measurement Studio, the focus of the User Interface components is adding the controls to Visual Studio that are needed for test and measurement applications. Visual Studio comes with a tabular type interface called the DataGrid control for displaying numeric and string data in a table format built-in. This is what you would want to use to display arrays. We
    would definately consider adding a table type interface if our users needed a lot more functionality than was provided by the Visual Studio DataGrid control.
    I know it can be frustrating going back and forth between the tools and seeing different things available. Remember, they are designed for different users though. Measurement Studio is designed to equip Visual Studio programmers to do Test & Measurement programming easily, it isn't designed to provide LabVIEW type functionality to Visual Studio users. So some LabVIEW functionality won't exist in Measurement Studio purposefully, and also some functionality in Measurement Studio that isn't in LabVIEW since it doesn't suit graphical programming.
    Try the DataGrid control, and let us know if it doesn't meet your needs.
    Best Regards,
    Chris Matthews
    National Instruments

  • How to use  array of obects  in jsp

    I had passed an array of objects (Bean object) by using
    request.setAttribute("Bean",req);
    but how i display the values in my textbox on clicking next or prev button of my jsp.
    Customer ID      <input type="text" name="customerid" value=<%=req.getCustomerid()%> >
    Date: <input type=text value=<%=req[i].getToday()%> name="today" >           
    how shud i use these values on button clicks.
    thanks

    Remember that JSP is a server side language. It can not react to client side button clicks, unless it reloads the entire page.
    You are only storing the attribute in request scope, so that array would not be available for the next request.
    To make it available for all requests of the same user, you have to use session scope.
    The button click code has to be written in javascript.
    How large a list are we talking about here? If it is small (< 50 elements) you could send it all as part of the html page, and change it in javascript.
    Otherwise you are looking at reloading the page, or making an ajax call.
    Cheers,
    evnafets

  • How to display a bulletted list

    Hi All,
    I'd like to display a list of agreements to the user as a bulleted list.  It's all the things that the user is agreeing to when they submit the application.
    What would be ideal is if there is a controller that I can bind to an array, and it will display each item in the array as a single bulleted list item.  The list of agreements will vary depending on how the user as filled out the application, and if I do it this way I could simply pass in a collection with all the items they are agreeing to.
    But I haven't been able to even figure out how to display a bulleted list.  I've found some posts online that address how you might do this if you're working on an editor, but I don't need editable text--I just want to display a bulleted list to users.  It seems like this is a basic feature that must be in Flex 4 somewhere, and I don't want to go reinventing the wheel.
    Thanks!
      -Josh

    Ok, here's what I came up with for a bulleted list that you can bind an ArrayCollection of String items to.  Thoughts?  Any issues with this implementation?
    I looked into a custom ItemRenderer, but this seemed much simpler and it's all I need in my case--a bulleted list.
    I'm aware that no escaping of the input strings is being done, but that's actually intentionally--I may wish to pass in strings that include additional markup to make certain words/phrases bold.
    The reason for the getter and setter on the dataProvider property is to ensure that anytime a new assignment is made to that property the change listeners are setup.
    I'm interested in feedback on how I could do this better or differently, to best take advantage of the facilities Flex offers.
    Thanks!
      -Josh
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               width="100%">
         <s:layout>
              <s:VerticalLayout/>
         </s:layout>
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   import mx.events.CollectionEvent;
                   import mx.events.FlexEvent;
                   private var _dataProvider:ArrayCollection;
                   public function get dataProvider():ArrayCollection{
                        if(_dataProvider == null){
                             dataProvider = new ArrayCollection();
                        return _dataProvider;
                   public function set dataProvider(value:ArrayCollection):void{
                        _dataProvider = value;
                        this.ensureBulletedListTextIsBuilt(dataProvider);
                        this.dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,handleItemsChange,false,0,true)
                   protected function handleItemsChange(event:CollectionEvent):void{
                        var collection:ArrayCollection = event.target as ArrayCollection;
                        this.ensureBulletedListTextIsBuilt(collection);
                   protected function ensureBulletedListTextIsBuilt(collection:ArrayCollection):void{
                        var html:String = "";
                        for each(var item:String in collection){
                             html += "<li>" + item + "</li>";
                        bulletedListText.htmlText = html;
              ]]>
         </fx:Script>
         <mx:Text id="bulletedListText" width="100%" />
    </s:Group>

  • How to display PSA screen capture on Front Panel

    Any one know how to display screen capture of PSA series specturm analyzer on front panel. I can save the JPEG file in the C drive, but I can't display on the front pannel. Please see my labview code.
    Solved!
    Go to Solution.
    Attachments:
    Capture screen E4446A.vi ‏21 KB
    reading and writing binary number.vi ‏22 KB
    yumg.jpg ‏20 KB

    Do you actually need to save the front panel image?  Or do you want to save a graph of the signal (spectrum) that you acquired?  If the latter will do the trick, you can simply read the waveform over GPIB (or whichever means you control the analyzer) into an array that is plotted to a waveform graph in LabVIEW.  You then save the image of the waveform graph as an image.
    Since you have all the data, you can even save the data which can be viewed later (and not only by LabVIEW).

  • How to display & sign

    Hi everyone,
    How to display & sign in below statements such as "A
    & B" and "X & Y". Thanks.
    <mx:dataProvider>
    <mx:Array>
    <mx:Object label="A & B" data="1" id="MensClothing"
    subcategoryImage="assets/images/MensClothing.gif" />
    </mx:Array>
    </mx:dataProvider>
    <mx:Button
    id="button_Home"
    x="20" y="2"
    fillAlphas="[0,0]"
    fillColors="[#4d4d4f, #4d4d4f]"
    label="X & Y" color="white" cornerRadius="0"
    click="Home()" />
    Thanks,
    May

    entity equivelant for & in XML is &amp;
    <mx:ButtonBar>
    <mx:dataProvider>
    <mx:Array>
    <mx:Object label="A &amp; B" data="1"
    id="MensClothing" subcategoryImage="assets/images/MensClothing.gif"
    />
    </mx:Array>
    </mx:dataProvider>
    </mx:ButtonBar>
    <mx:Button
    id="button_Home"
    x="20" y="2"
    fillAlphas="[0,0]"
    fillColors="[#4d4d4f, #4d4d4f]"
    label="X &amp; Y" color="white" cornerRadius="0"
    click="false" />

  • How to display sub categories ?

    hi
    How to display categories and sub categories and its sub categories.
    We don’t know the depth of sub categories.. so how it can the categories be displayed?
    Could anybody can provide the solution ASAP ?
    Thanks & Regards
    user8729783

    user8729783 wrote:
    hi
    How to display categories and sub categories and its sub categories.
    You can use below:
    <dsp:droplet name="ForEach">
      <dsp:param bean="Profile.catalog.allRootCategories" name="array"/>
      <dsp:oparam name="output">
      <dsp:valueof param="element.displayName"/>
      <%-- diplay subCategories --%>
      <dsp:droplet name="ForEach">
      <dsp:param name="array" param="element.childCategories"/>
      <dsp:oparam name="output">
      <dsp:valueof param="element.displayName"/>
      </dsp:oparam>
      </dsp:droplet>
      </dsp:oparam>
    </dsp:droplet>
    -RMishra

  • How to display discount price amt in order confirmation page

    hi,
    I created a discount for site,who places any order will get a discount for that particular order ,How to display discount price amt in order confirmation page.suggest some points guys.

    Try displaying it as following , just put the jsp code for the if() statement i have put below.
    This block loops through order level adjustments and displays the discounts for the one's associated with order promotions.
    <dsp:droplet name="ForEach">
    <dsp:param name="array" bean="ShoppingCart.current.priceInfo.adjustments" />
    <dsp:param name="elementName" value="pricingAdjustment" />     
    <dsp:oparam name="output">
    //displaying if discount was provided, associated with some order level promotion
    if (pricingAdjustment.getPricingModel() != null && pricingAdjustment.getAdjustment() < 0) {
    <dsp:valueof param="pricingAdjustment.totalAdjustment" />
    </dsp:oparam>
    </dsp:droplet>

  • How to display the contents of the database values which are retrived.

    how to display the contents of the database values which are retrived in servlets and i am able to display the contents in the servlets and if forward to jsp using requestdespatcher,the values are to be shown in jsp one below the other.please suggest me in these........the servlet code is as shown
    while(rs.next()){
                        buffer.append(rs.getString(1));
                        buffer.append(rs.getString(2));
                        buffer.append(rs.getString(3));
                        buffer.append(rs.getString(4));
                        buffer.append(rs.getString(5));
                        buffer.append(rs.getString(6));
                        buffer.append(rs.getString(7));
                        buffer.append(rs.getString(8));
                        buffer.append(rs.getString(9));
                        buffer.append(rs.getString(10));
                        request.setAttribute("result1",buffer);
                        RequestDispatcher rq=request.getRequestDispatcher("/results.jsp");
                        rq.forward(request,response);
    in jsp iam using the getAttribute to retrieve the values as shown
    <% StringBuffer sb=(StringBuffer)request.getAttribute("result1"); %>
    <%= sb %>
    but getting the results in the stretch,i need to display the result one below the other.

    if you load it all into the buffer that is going to be very difficult. I would suggest loading it into some sort of collection. I like using an ArrayList.
    Then pass the arraylist.
    you will then on the jsp iterate through the arrayList using what every you want.. el, logic tags, scriplets.
    so something like
    ArrayList arrayList = new ArrayList();
    while(rs.next()){
    arrayList.append(rs.getString(1));
    //or possibly an arrayList of String arrays
    //maybe using nested for loops.  Inner for loop adds result to string[] then //outer adds string[] to arrayList.
    //can be done any number of ways based on your expected result set.

Maybe you are looking for

  • HT201210 ipod touch frozen on connect usb  and will not sync

    my ipod touch has frozen on connect usb and will not sync

  • Runtime error in KM

    Hi Experts,   When i preview user profile iview it shows message like this "The requested page has been replaced by the new Web Dynpro based administration. Please refer to SAP Note 869852 if you want to use the old administration UI. Click on the fo

  • Java Uninstall Problem

    Java Uninstall Problem This all came about because of a failed uninstall, using Your Uninstaller. The {Java runtime which is all I want) is not listed now & I tried all the other fix bad uninstall type features, all to no avail.} ) When I DL & run th

  • Video Monitoring System

    I have just downloaded the Cisco Video Monitoring System. The look and feel are GREAT! BUT... I cant seem to figure out how to make it work for me I have 2 monitors i would like the Cisco Video Monitoring System on SCREEN #2 not Screen #1.. and there

  • HT1595 I had an issue with my apple cannot connect wi fi net work

    I had problem of my Apple TV cannot connect to wifi