Solved

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

Posted on 2009-04-01
4
570 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
struts spring hibernate example 12 131
How to identify SSH user interactive login? 15 82
can't umount nfs share after server goes offline... 4 91
How to Edit Files in Linux 6 122
Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 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