Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

confused on JSP Call JavaBeans

ligangligang Member Posts: 76
The Bean is :
package example_h;
import java.util.*;

public class CalBean
{
private double[] num;
public CalBean()
{
num = new double[2];
num[0] = 1;
num[1]=2;
}
public double getAverage()
{
double sum = 0;
for (int i=0;i

calculate data




Arrays

averrage:





The running result is

Arrays 45.046.047.0 averrage:
2.0

the average value is calculated properly however the array value displayed wrongly .
I do not quite understand on


There is no numList property in Bean , but actual 1,2,3 has passed to bean correctly .

Could someone give a hint?



Comments

  • jakemcbeerjakemcbeer Member Posts: 10
    The numList property is derived from the accessor methods as follows...

    getX
    setX

    x is the property name.

    so...

    setNumList
    getNumList

    numList is taken to be the property name.

  • Shawn CarterShawn Carter Member Posts: 0

    { http://forcoder.org } free video tutorials and ebooks about [ C Assembly Ruby Java Visual Basic Scratch Delphi PL/SQL Swift C# MATLAB JavaScript Go C++ PHP Objective-C R Perl Python Visual Basic .NET Julia VBScript Transact-SQL D Ada FoxPro Lisp Crystal Dart Lua Rust Scala ML Awk Kotlin Alice LabVIEW COBOL Hack Prolog Bash Logo SAS Erlang F# Fortran Clojure Apex ABAP Scheme ]

Sign In or Register to comment.