Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / April 2005

Tip: Looking for answers? Try searching our database.

jsp error with j2ee

Thread view: 
Ian - 22 Apr 2005 17:52 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.