Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP output a variable  RSS feed

 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I am totally new to JSP and am running through a good tutorial that I have found applying.

I can get it all to work apart from outputting a variable using JSTL/jsp 2.. not sure what part it is that is not working:

I am outputting this:
<cut value="${emp.name}"/>

but all that is displayed to the screen is ${emp.name}

I have the tag lib correctly at the top:
<%@ taglib prefix="c" uri="/tags/core" %>

and this is specified in my web.xml as
<taglib>
<taglib-uri>/tags/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

I get no errors just no display.
This is all from following this tutorial:
http://www.learntechnology.net/struts-lesson-1.do

I am running J-Boss 4.0.4 on a windows machine.

Any help or hints would be gratefully appreciated.

cheers
Martin
[ June 21, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, you've over-complcated things by extracting the tld from the jar file. You shoud be able to just dump the jar file into the lib folder and use the correct JSTL URI. No tld delarations in the web.xml should be necessary.

Secondly, it sounds as if your web.xml itself is not delcared correctly as a 2.4 web app. See the JSP FAQ for details.
 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

Thank you for your reply.

I have gone to the java FAQ and added this to the top of my web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xls="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">

I removed the doctype declaration from the web.xml as described.

But when I start the JBoss server and it tries to deploy my application I get a number of errors, related to the declaration, such as:

org.xml.SAXParseException: The prefix "xsi" for attribute "xsi:schemaLocation" associated with element "web-app" is not bound.
at org.apache.xerces.parsers.DOMparser.parse (Unknown source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse (Unknown source)
at org.jboss.metadata.XMLFileLoader.getDocument(XMLFileLoader.java:328)

Again thanks for your reply.

cheers
Martin
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of Tomcat are you using with JBoss? It must be Tomcat 5 for all this to woek.
 
Will Fleming
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jBoss 4.0.4 has Tomcat 5.5.
[ June 21, 2006: Message edited by: Will Fleming ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, perhaps you should post your web.xml. Be sure to enclose it in UBB code tags to preserve the formatting.
 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help but I got to the root of the problem in the end, there was something wrong in my declaration after copy pasting it it worked fine.

Thanks for your time

cheers
Martin
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!