Solved

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

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

-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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

17 Experts available now in Live!

Get 1:1 Help Now