Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSP output a variable

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
<c:out 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 ]
 
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of Tomcat are you using with JBoss? It must be Tomcat 5 for all this to woek.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jBoss 4.0.4 has Tomcat 5.5.
[ June 21, 2006: Message edited by: Will Fleming ]
 
Bear Bibeault
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
brevity is the soul of wit - shakepeare. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic