?
Solved

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

Posted on 2009-04-01
4
Medium Priority
?
573 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 28

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 28

Accepted Solution

by:
rrz earned 2000 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

Supports up to 4K resolution!

The VS192 2-Port 4K DisplayPort Splitter is perfect for anyone who needs to send one source of DisplayPort high definition video to two or four DisplayPort displays. The VS192 can split and also expand DisplayPort audio/video signal on two or four DisplayPort monitors.

Question has a verified solution.

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

-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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

771 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