Solved

how to write my first jsp file and compile and run it correctly

Posted on 2009-04-01
4
571 Views
Last Modified: 2013-12-02
that is my first jsp file
http://localhost:8080/jsp-examples/firstjsp.jsp

I get this error message  with code number 500
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /firstjsp.jsp(9,0) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
      org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
      org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
      org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
      org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:952)
      org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:706)
      org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
      org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
      org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
      org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
      org.apache.jasper.compiler.Validator.validate(Validator.java:1484)
      org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.
Apache Tomcat/5.5.27

please help me get it run and compile
best regards
hatem gamal
firstjsp.jsp
 
<%-- use the 'taglib' directive to make the JSTL 1.0 core tags available --%>
 
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
 
<%-- use the 'jsp:useBean' standard action to make the Date object available in page scope --%>
 
<jsp:useBean id="date" class="java.util.Date" />
 
<html>
 
<head><title>First JSP</title></head>
 
<body>
 
<h2>Here is today's date</h2>
 
<c:out value="Date: ${date}" />
 
</body>
 
</html>

Open in new window

0
Comment
Question by:hatem_from_mesr
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Murali Murugesan
ID: 24045609
Hi,

<c:out value="Date: ${date}" /> - this is the line having problem , change as below

Date:<c:out value="${date}" />

-Murali*

0
 
LVL 27

Expert Comment

by:rrz
ID: 24045708
><c:out value="Date: ${date}" />  
Murili is correct, but since you are using Tomcat 5.5 and Servlet 2.4 API, you could also  just use    
Date: ${date}    
0
 

Author Comment

by:hatem_from_mesr
ID: 24049110
MuraliKanth,rrz@871311
>>>Date:<c:out value="${date}" />
I tried it and no good
I heard something about deployment descriptor
can you tell me how to configure the deployment descriptor so that it runs
0
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 24050320
>can you tell me how to configure the deployment descriptor so that it runs  
If you are  using  
>http://localhost:8080/jsp-examples/firstjsp.jsp 
aren't you using the pre-installed web app jsp-examples ? If so the deployment descriptor is already there look at  
jsp-examples/WEB-INF/web.xml    
>I tried it and no good
Same error ?  
Did you try my solution.
Date: ${date}    
Anyway here is something we missed yesterday.  If you are using JSTL 1.1 then replace
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>  
with
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse luna javeEE perspecive missing 5 119
Vmware tools installation in ubuntu 14.04 11 108
Monitor Aliased network interface bandwitch CentOS 4 103
DTD and JAVA versions 1 34
-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question