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 - 21 Apr 2005 19:24 GMT
Silly question, but shouldn't MyInput be in quotes, e.g.
mybean.getCustomers("MyInput");
> Hi,
> Please forgive if wrong place to post but I'm not sure where is?
[quoted text clipped - 20 lines]
>
> ps change the ZZ to au if direct reply thanks.
millerch - 21 Apr 2005 19:44 GMT
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"
> Hi,
> Please forgive if wrong place to post but I'm not sure where is?
[quoted text clipped - 20 lines]
>
> ps change the ZZ to au if direct reply thanks.
Malte - 22 Apr 2005 12:35 GMT
> Hi,
> Please forgive if wrong place to post but I'm not sure where is?
[quoted text clipped - 20 lines]
>
> 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.
kaeli - 22 Apr 2005 18:30 GMT
> Hi,
> Please forgive if wrong place to post but I'm not sure where is?
[quoted text clipped - 4 lines]
> 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.

Signature
--
~kaeli~
A hangover is the wrath of grapes.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
Michael Berg - 22 Apr 2005 23:14 GMT
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