Solved

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

Posted on 2009-04-01
4
567 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

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

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

This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now