File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deploying jsp using jstl tag libraaries

 
naresh kumar k
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am naresh
here are my jsp and web,xml file
//DemoCon.jsp
<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<body bgcolor=lightblue>
<form method=post action=DemoCon.jsp>
<select name="option">
<option value="sam">sam
<option value="tom">tom
</select>
<input type=submit>
</form>
<c:set var="s" value="${param.option}" />
<cut value="${s}" />
<br>

<c:if test="${s eq 'sam' }" >
<cut value="Good Morning...SAM!" />
</c:if>

<c:if test="${s = = 'tom'}" >
<cut value=" How Are You?....TOM!" />
</c:if>
</body>
</html>

//web.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" />

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>

</web-app>

i copied jstl and standard jar files into WEB-INF /lib and also all tld files into WEB-INF/tld of my project directory
but i am facing following errors can any one please help regarding this one
INFO: Deploying web application directory ConditionDemo
May 25, 2011 11:27:54 AM org.apache.tomcat.util.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 4 column 4: The markup in the document followi
ng the root element must be well-formed.
org.xml.sax.SAXParseException: The markup in the document following the root ele
ment must be well-formed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAX
ParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalErro
r(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(U
nknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Traili
ngMiscDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U
nknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(Contex
tConfig.java:365)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:10
76)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
611)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
9)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
25)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
May 25, 2011 11:27:54 AM org.apache.catalina.startup.ContextConfig applicationWe
bConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/ConditionDemo
/WEB-INF/web.xml
org.xml.sax.SAXParseException: The markup in the document following the root ele
ment must be well-formed.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(Contex
tConfig.java:365)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:10
76)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
611)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
9)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
25)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
May 25, 2011 11:27:54 AM org.apache.catalina.startup.ContextConfig applicationWe
bConfig
SEVERE: Occurred at line 4 column 4
May 25, 2011 11:27:54 AM org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
May 25, 2011 11:27:54 AM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
May 25, 2011 11:27:54 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ConditionDemo] startup failed due to previous errors
May 25, 2011 11:27:54 AM org.apache.catalina.startup.HostConfig deployDirectory


please help me
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

When posting code please UseCodeTags.

First thing is to remove the <taglib> element form the web.xml. It is incorrect and unnecessary. Then we can see what else might be wrong.
 
Stefan Evans
Bartender
Posts: 1640
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue is in fact caused by the presence of the <taglib> entries.

From 2.4 onwards, the <taglib> entry in web.xml needs to be enclosed in a <jsp-config> element.
So the following would be your fixed web.xml file.



However as Bear said, having an entry for the tag library in your web.xml file is unnecessary.
The container is smart enough to detect the JSTL libraries from the tld files included in the META-INF directory of the jstl library jars.
So the best solution is in fact to remove the <taglib> entry from web.xml.



 
naresh kumar k
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Welcome to the Ranch.

When posting code please UseCodeTags.

First thing is to remove the <taglib> element form the web.xml. It is incorrect and unnecessary. Then we can see what else might be wrong.


hi Bear thanks for your response.
i got my project deployed successfully but i am again facing problem while running on browser.
like.......

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /DemoCon.jsp(12,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:1209)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:846)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1763)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

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

Can you please help on this
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and also all tld files into WEB-INF/tld

Did you remove the tld files?
 
naresh kumar k
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
and also all tld files into WEB-INF/tld

Did you remove the tld files?


I did that but still i am facing those problems
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it's clearly unhappy about the format of some XML file. Are you sure there is not more information in the logs that identifies which file?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic