jsp error with j2ee

Discussion in 'Java' started by millerch, Apr 21, 2005.

  1. millerch

    millerch Guest

    Silly question, but shouldn't MyInput be in quotes, e.g.
    mybean.getCustomers("MyInput");


    Ian wrote:
    > Hi,
    > Please forgive if wrong place to post but I'm not sure where is?
    >
    > I have a jsp page which verifies OK (along with all other classes etc) with
    > the J2EE appServer until I make a call to a method in MyBean.java with the
    > following statement below, I am getting an error that says all jsps must be
    > compilable:
    > ...
    > ...
    > String myString = request.getParameter("MyInput"); //this
    > is OK
    > // but if I add this line into my jsp page:
    > <p>customers are <%= mybean.getCustomers(MyInput); %> // fails
    >
    > in MyBean.java I have the following method:
    > public Collection getCustomers(String myString);
    > ...
    > ...
    > All my other method calls seem to work OK but I am not seeing what is wrong
    > Any help appreciated
    > regards
    > Eric
    >
    > ps change the ZZ to au if direct reply thanks.
    >
    >
    millerch, Apr 21, 2005
    #1
    1. Advertising

  2. millerch

    millerch Guest

    Ok, the semicolon is not required, and MyInput should be in quotes e.g.
    <p>customers are <%=mybean.getCustomers("MyInput")%>

    But Malte and Kaeli are correct, the result will be an object reference
    and a HashCode siomething like "java.util.Collection@12345"


    Ian wrote:
    > Hi,
    > Please forgive if wrong place to post but I'm not sure where is?
    >
    > I have a jsp page which verifies OK (along with all other classes etc) with
    > the J2EE appServer until I make a call to a method in MyBean.java with the
    > following statement below, I am getting an error that says all jsps must be
    > compilable:
    > ...
    > ...
    > String myString = request.getParameter("MyInput"); //this
    > is OK
    > // but if I add this line into my jsp page:
    > <p>customers are <%= mybean.getCustomers(MyInput); %> // fails
    >
    > in MyBean.java I have the following method:
    > public Collection getCustomers(String myString);
    > ...
    > ...
    > All my other method calls seem to work OK but I am not seeing what is wrong
    > Any help appreciated
    > regards
    > Eric
    >
    > ps change the ZZ to au if direct reply thanks.
    >
    >
    millerch, Apr 21, 2005
    #2
    1. Advertising

  3. millerch

    Malte Guest

    Ian wrote:
    > Hi,
    > Please forgive if wrong place to post but I'm not sure where is?
    >
    > I have a jsp page which verifies OK (along with all other classes etc) with
    > the J2EE appServer until I make a call to a method in MyBean.java with the
    > following statement below, I am getting an error that says all jsps must be
    > compilable:
    > ...
    > ...
    > String myString = request.getParameter("MyInput"); //this
    > is OK
    > // but if I add this line into my jsp page:
    > <p>customers are <%= mybean.getCustomers(MyInput); %> // fails
    >
    > in MyBean.java I have the following method:
    > public Collection getCustomers(String myString);
    > ...
    > ...
    > All my other method calls seem to work OK but I am not seeing what is wrong
    > Any help appreciated
    > regards
    > Eric
    >
    > ps change the ZZ to au if direct reply thanks.
    >
    >

    Assuming that you have used the myString variable to call setCustomers,
    getCustomers() will return a collection. What is the JSP supposed to do
    with that? If you want the customers listed, you could have
    getCustomers() return a String. Or simply provide a
    getCustomersAsFormattedHTML() metod.
    Malte, Apr 22, 2005
    #3
  4. millerch

    Ian Guest

    Hi,
    Please forgive if wrong place to post but I'm not sure where is?

    I have a jsp page which verifies OK (along with all other classes etc) with
    the J2EE appServer until I make a call to a method in MyBean.java with the
    following statement below, I am getting an error that says all jsps must be
    compilable:
    ....
    ....
    String myString = request.getParameter("MyInput"); //this
    is OK
    // but if I add this line into my jsp page:
    <p>customers are <%= mybean.getCustomers(MyInput); %> // fails

    in MyBean.java I have the following method:
    public Collection getCustomers(String myString);
    ....
    ....
    All my other method calls seem to work OK but I am not seeing what is wrong
    Any help appreciated
    regards
    Eric

    ps change the ZZ to au if direct reply thanks.
    Ian, Apr 22, 2005
    #4
  5. millerch

    kaeli Guest

    In article <42692bd4$>,
    enlightened us with...
    > Hi,
    > Please forgive if wrong place to post but I'm not sure where is?
    >
    > I have a jsp page which verifies OK (along with all other classes etc) with
    > the J2EE appServer until I make a call to a method in MyBean.java with the
    > following statement below, I am getting an error that says all jsps must be
    > compilable:
    > ...


    Exact error and stack trace?
    Hard to say what is going on without that.
    There is possibly a syntax error in the jsp somewhere, but the stack trace
    and exact error would pinpoint that. If it IS a syntax error, you need to
    post the real code, including where you got "myBean" and MyInput from. Did
    you delare it? Call the constructor? Etc. Is MyInput declared as a String and
    not null?

    Also, using <%= => for a method that returns a Collection isn't going to help
    you much.

    --
    --
    ~kaeli~
    A hangover is the wrath of grapes.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, Apr 22, 2005
    #5
  6. millerch

    Michael Berg Guest

    Hi,

    > String myString = request.getParameter("MyInput");

    //this
    > is OK
    > // but if I add this line into my jsp page:
    > <p>customers are <%= mybean.getCustomers(MyInput); %> // fails


    Try this:

    <p>customers are <%= mybean.getCustomers(myString); %>

    Make sure your getCustomers method expects a string as parameter and returns
    a string as result.

    /Michael
    www.hyperpal.com
    www.bergconsult.com
    Michael Berg, Apr 22, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ross M. Greenberg

    LAMP & J2EE as opposed to LAMP vs J2EE

    Ross M. Greenberg, Dec 12, 2004, in forum: Java
    Replies:
    6
    Views:
    1,365
    Robert kebernet Cooper
    Dec 24, 2004
  2. T.G.
    Replies:
    1
    Views:
    489
    Raymond DeCampo
    Jan 4, 2006
  3. Replies:
    0
    Views:
    4,314
  4. mehdi mousavi
    Replies:
    0
    Views:
    1,014
    mehdi mousavi
    Feb 15, 2009
  5. Rajive Narain
    Replies:
    0
    Views:
    1,306
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page