Could someone please look at this?  I do not understand what is wrong but it
keeps erroring out.

                <% if (doc.field("VdkVgwKey").endsWith(".txt"))
                {
                   ="/images/Icon_word.gif";
                }  %>

getting this error message:

[15/Apr/2002:09:37:14] warning (  408): Internal error: Failed to get
GenericServlet. (uri=/all/results.jsp,SCRIPT_NAME=/all/results.jsp)
[15/Apr/2002:09:38:21] info (  408): JSP: JSP1x compiler threw exception
org.apache.jasper.JasperException: Unable to compile class for
JSP/usr/local/netscape/server4/https-kb-dev/config/../ClassCache/_jsps/_all/
_results_jsp.java:557: Missing term.
                                {
Thank you in advance
Lance Prais


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Richard Yee
Sent: Thursday, April 11, 2002 6:36 PM
To: [EMAIL PROTECTED]
Subject: Re: Endswith question


Lance,
Check the Javadocs.
The method name is endsWith(String s)

You can't use a switch statement b/c endsWith returns a boolean. You would
have to use a if-else if    construct.

You need something like:
String fileName;
.
.
.
/* assign a string to filename */
if (filename.endsWith(".txt")
{
         // Do something
}
else if (filename.endsWith(".pdf")
{

}
// etc.
.
.
.


Regards,

Richard

At 06:17 PM 4/11/2002 -0500, you wrote:
>I have two questions:
>
>1. I have the following line:
>         ConnectMode_OfficeMode.pdf
>    I want to check to see what the .filetype is.  I assume I would use
>    If endswith(txt)
>         {
>                 DO SOMETHING
>         }
>It is not working?
>
>2. I have multiple items that I will be checking therefore I was thinking
of
>using  switch...case
>    String s = null;
>    Switch(test)
>         {
>                 case endswith(txt)
>                 s= something;
>                 case endswith(doc)
>                 s= something else;
>                 case endswith(html)
>                 s= something more;
>      }
>This does not seem to work.
>
>COuld someone either take a look at the code and let me know what you see.
>
>Thanks is advance
>Lance
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to