Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

JSP: Classes, methods?
Hi there,

I began doing some JSP and trying out something. One of the first
things I learned was what the error-Site of Tomcat 5 looks like... My
problem: The following code is reported to have an error:

<snip>
cannot resolve symbol
symbol  : method length (java.lang.String)
location: class org.apache.jsp.test.test.test_jsp
output = length(test);
^
<snap>

The code is:

<%!
String test;
int output;
%>
<%
test = "foo";
output = length(test);
%>
<html>
<head>
<title>Test</title>
</head>
<body>
Test!<br>
<br>
<%= output %><br>
<br>
</body>
</html>

Any ideas? Do I have to import/include classes? Which ones? How?

Thanks for your help!

Report this thread to moderator Post Follow-up to this message
Old Post
Spocht
09-23-04 01:57 PM


Re: JSP: Classes, methods?
udo.f@gmx.net (Spocht) writes:

> output = length(test);

Java is an object-oriented languiage; this means that methods don't
exist on their own, but as part of objects or classes.

You don't call a function on a structure like you would in C, you use
a method associated with the object:

output = test.length();

Report this thread to moderator Post Follow-up to this message
Old Post
Tor Iver Wilhelmsen
09-23-04 01:57 PM


Re: JSP: Classes, methods?
On 23 Sep 2004 01:17:58 -0700, udo.f@gmx.net (Spocht) wrote:

>Hi there,
>
>I began doing some JSP and trying out something. One of the first
>things I learned was what the error-Site of Tomcat 5 looks like... My
>problem: The following code is reported to have an error:
>
><snip>
>cannot resolve symbol
>symbol  : method length (java.lang.String)
>location: class org.apache.jsp.test.test.test_jsp
>output = length(test);
>         ^
><snap>
>
>The code is:
>
><%!
>String test;
>int output;
>%>
><%
>test = "foo";
>output = length(test);

try
output = test.length();

>%>
><html>
><head>
><title>Test</title>
></head>
><body>
>Test!<br>
><br>
><%= output %><br>
><br>
></body>
></html>
>
>Any ideas? Do I have to import/include classes? Which ones? How?
>
>Thanks for your help!


--
now with more cowbell

Report this thread to moderator Post Follow-up to this message
Old Post
Bryce
09-23-04 08:59 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:29 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.