jsp error with j2ee

M

millerch

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

millerch

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"
 
M

Malte

Ian said:
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.
 
I

Ian

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

kaeli

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.

--
 
M

Michael Berg

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Issue with textbox script? 0
JSP 0
Regarding Jsp And Java 1
Error when reading file from command prompt 5
Getting started with J2EE 3
learning to code - question on dictionary example 5
JSP & J2EE 4
J2EE Tutorial 1

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top