Jsp taglibs and jsp commands...

Another question about taglibs...
If I want to use the body in a tag together with a class which is used in the tag code.
For example I want to do the following:
<foo:listStudents>
<%= student.fname %> <%= student.lname %> <%= student.id %>
</foo:listStudents>
Do I have to use the TagExtraInfo or? The class Student (student) is ofcourse declared and used in the tag.
Regards Per Jonsson

I am also on the lookout for this. i have posted many times but no one has answered my question till now. if you get to know the answer do inform me at
[email protected]
Regards
Ramesh Kesavanarayanan

Similar Messages

  • Taglib and JSP problem

    Hi!
    I cannot determine why I'm getting the following error:
    I've installed Apache Tomcat/4.0.6
    "PARSE error at line 6 column 19
    org.xml.sax.SAXParseException: Element type "taglib" must be declared."
    Can you tell why the parser does not recognize it?
    Appreciate any help.
    ele
    [my JSP]
    <%@ page language="java" import="java.lang.*,java.util.*,javax.servlet.jsp.*,java.io.PrintWriter,javax.servlet.http.HttpServletResponse,javax.servlet.jsp.JspWriter" %>
    <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
    [my web.xml]
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <display-name>SegDis</display-name>
    <description></description>
    <servlet>
    <servlet-name>ScriviPunto</servlet-name>
    <servlet-class>ScriviPunto</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>lanciaScriviPunto</servlet-name>
    <jsp-file>/lanciaScriviPunto.jsp</jsp-file>
    </servlet>
    <servlet>
    <servlet-name>segnalazione</servlet-name>
    <jsp-file>/segnalazione.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
    <servlet-name>ScriviPunto</servlet-name>
    <url-pattern>/scriviPunto</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>lanciaScriviPunto</servlet-name>
    <url-pattern>/lanciaScriviPunto.jsp</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>segnalazione</servlet-name>
    <url-pattern>/segnalazione.jsp</url-pattern>
    </servlet-mapping>
    <taglib>
         <taglib-uri>/WEB-INF/c.tld</taglib-uri>
         <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    </web-app>
    [the .tld file (downloaded from Sun)]
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>c</short-name>
    <uri>http://java.sun.com/jstl/core</uri>
    <display-name>JSTL core</display-name>
    <description>JSTL 1.0 core library</description>
    <validator>
    <validator-class>
         org.apache.taglibs.standard.tlv.JstlCoreTLV
    </validator-class>
    <init-param>
         <param-name>expressionAttributes</param-name>
         <param-value>
         out:value
         out:default
         out:escapeXml
         if:test
         import:url
         import:context
         import:charEncoding
         forEach:items
         forEach:begin
         forEach:end
         forEach:step
         forTokens:items
         forTokens:begin
         forTokens:end
         forTokens:step
         param:encode
         param:name
         param:value
    redirect:context
    redirect:url
         set:property
         set:target
         set:value
         url:context
         url:value
         when:test
         </param-value>
         <description>
         Whitespace-separated list of colon-separated token pairs
         describing tag:attribute combinations that accept expressions.
         The validator uses this information to determine which
         attributes need their syntax validated.
         </description>
    </init-param>
    </validator>
    <tag>
    <name>catch</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
    <body-content>JSP</body-content>
    <description>
    Catches any Throwable that occurs in its body and optionally
    exposes it.
    </description>
    <attribute>
    <name>var</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>choose</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
    <body-content>JSP</body-content>
    <description>
    Simple conditional tag that establishes a context for
    mutually exclusive conditional operations, marked by
    <when> and <otherwise>
    </description>
    </tag>
    <tag>
    <name>out</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.OutTag</tag-class>
    <body-content>JSP</body-content>
    <description>
         Like <%= ... >, but for expressions.
    </description>
    <attribute>
    <name>value</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>default</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>escapeXml</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>if</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.IfTag</tag-class>
    <body-content>JSP</body-content>
    <description>
    Simple conditional tag, which evalutes its body if the
    supplied condition is true and optionally exposes a Boolean
    scripting variable representing the evaluation of this condition
    </description>
    <attribute>
    <name>test</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>var</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>import</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.ImportTag</tag-class>
    <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
    <body-content>JSP</body-content>
    <description>
         Retrieves an absolute or relative URL and exposes its contents
         to either the page, a String in 'var', or a Reader in 'varReader'.
    </description>
    <attribute>
    <name>url</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>var</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>varReader</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>context</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>charEncoding</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>forEach</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.ForEachTag</tag-class>
    <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
    <body-content>JSP</body-content>
    <description>
         The basic iteration tag, accepting many different
    collection types and supporting subsetting and other
    functionality
    </description>
    <attribute>
         <name>items</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>begin</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>end</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>step</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>var</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>varStatus</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>forTokens</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.ForTokensTag</tag-class>
    <body-content>JSP</body-content>
    <description>
         Iterates over tokens, separated by the supplied delimeters
    </description>
    <attribute>
         <name>items</name>
         <required>true</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>delims</name>
         <required>true</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>begin</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>end</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>step</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>var</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
         <name>varStatus</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>otherwise</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
    <body-content>JSP</body-content>
    <description>
         Subtag of <choose> that follows <when> tags
         and runs only if all of the prior conditions evaluated to
         'false'
    </description>
    </tag>
    <tag>
    <name>param</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.ParamTag</tag-class>
    <body-content>JSP</body-content>
    <description>
         Adds a parameter to a containing 'import' tag's URL.
    </description>
    <attribute>
    <name>name</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>value</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>redirect</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.RedirectTag</tag-class>
    <body-content>JSP</body-content>
    <description>
         Redirects to a new URL.
    </description>
    <attribute>
    <name>var</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>url</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>context</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>remove</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
    <body-content>empty</body-content>
    <description>
         Removes a scoped variable (from a particular scope, if specified).
    </description>
    <attribute>
    <name>var</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>set</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.SetTag</tag-class>
    <body-content>JSP</body-content>
    <description>
         Sets the result of an expression evaluation in a 'scope'
    </description>
    <attribute>
    <name>var</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>value</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>target</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>property</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>url</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.UrlTag</tag-class>
    <body-content>JSP</body-content>
    <description>
         Prints or exposes a URL with optional query parameters
    (via the c:param tag).
    </description>
    <attribute>
    <name>var</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>value</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>context</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    <tag>
    <name>when</name>
    <tag-class>org.apache.taglibs.standard.tag.el.core.WhenTag</tag-class>
    <body-content>JSP</body-content>
    <description>
    Subtag of <choose> that includes its body if its
    condition evalutes to 'true'
    </description>
    <attribute>
    <name>test</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    </taglib>

    this is a wild guess, but make sure the taglib text you added to your web.xml doens't contain funky characters you may have copied from some web page. i.e. retype it by hand if you copied it.
    If that isn't it.. sorry i don't see a problem.

  • Jsp include and jsp param

    Hi All,
    I have the following:
    <jsp:include page="anotherPage.jsp">
            <jsp:param name="testing" value="sdfasdfsd"/>
    </jsp:include> And in anotherPage.jsp I have:
    <%@ taglib uri="/WEB-INF/tld/commons-log.tld" prefix="log" %>
    <log:dump scope="request"/>
    <log:dump scope="session"/>
    <log:dump scope="page"/>
    <log:dump scope="application"/>
    <h3>
    Test: <%= request.getParameter("testing") %>
    </h3>Not only does this output:
    Test: null
    but I don't see 'testing' anywhere in the dumps! What is going wrong?
    Have I badly misunderstood parameter sending? :-/
    Actually, my assumption was that the include code puts the "testing" variable
    into the request.. 1) where does jsp:param put the data items it
    passes through and 2) if the data item didn't previously exist as a
    request parameter, does it ignore it?
    Any assistance would be most appreciated!
    Rob
    :)

    Depends on the server version you are using. If you are using a JSP 2.0 server like Tomcat 5, then you should be able to do that, as long as you set up the container correctly (to use servlet 2.4 and JSP 2.0 specs rather than 2.3 and 1.2...)
    Is you are using a JSP 1.2 container (less then TC5) then you will not be able to use EL anyware except in JSTL tags. The fix is to use the JSTL tags to do the include:
    <c:import url="thepage.jsp">
      <c:param name="param1" value="${attr}"/>
    </c:import>

  • Taglib and jsp pages question

    Hi, I just recently got tag libraries to work and I am wanting to send a dynamic attribute that has a value which is stored in the session. The problem is that I believe that the tag library is processed before the actual jsp code is, and therefore I get something like
    <%= someObj.getValue() %> instead of the actual value. Has anyone else encountered this issue and if so could you please recommend some solution(s)?
    Here is how I call the taglibg:
    <countytaglib:countyList state="TN" selectedCounty="<%= county %>" />
    The value ends up being '<%= county %>' instead of the actual value.
    Any help is appreciated. Thank you all in advance!
    -PV

    The required is only if the attribute is required.
    For your question's answer the rtexprvalue should only be true.
    in the TLD file for the TAG, for every attribute whose
    value can be evaluated by the JSP scriptlet put as
    follows:
    <attribute>
    <name>attribute_name</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>rtexpvalue should be specified to true in case for the
    attribute
    name you would like something like
    <%= user.getFirstName() %>Hope that helps.

  • Qns about jsp:include and jsp:forward

    It is said that <jsp:include>'s flush is only fixed to "true". Which means the page cannot pass its full control to another page using <jsp:forward> tag.
    Is there any ways to overcome this problem? Using both in the same jsp and allow it to passes full control.

    Hmm.. I'm using the form action to call back the jsp itself to validate something, and the include to add in another jsp file together with the original jsp to produce some addon visual effects.
    So saying if validate is true, forward to another jsp.
    So the form action.. cannot be use I think.

  • Weird behaviour with jsp:forward and jsp:param

    I'm running Orion 1.5.3
    Wanted to ask if anyone has insight into the following.
    I'm trying to do a forward with a parameter. The parameter is something like a message string.
    The following does not work.
    <%
    String result = "unsucessful"; // retrieved from external source... hardcoded for example's sake
    %>
    <jsp:forward page="<%=nextPage%>">
    <jsp:param name="message" value="The result was <%=result%>"/>
    </jsp:forward>
    I've managed to deduce that the error is in the param value. Apparently, we cannot mix variables with static values inside the value parameter.
    I've managed to get it working by doing this...
    <%
    String result = "unsucessful"; // retrieved from external source... hardcoded for example's sake
    String message = "The result was " + result;
    %>
    <jsp:forward page="<%=nextPage%>">
    <jsp:param name="message" value="<%=message%>"/>
    </jsp:forward>
    My question is, is this a bug or is it supposed to be this way ? Can we mix the value parameters ?

    Hi Bernard,
    Take a note of the following syntax -
    <jsp:forward page={"relativeURL" | "<%= expression %>"} >
    <jsp:param name="parameterName"
    value="{parameterValue | <%= expression %>}" />+
    </jsp:forward>
    It is evident that either the value attribute can have an expression or simple text.
    I have tried your example and I am also encountering the same kind of problem, but I have found a way out.
    You can try the following in your code -
    <%
    String result = "unsucessful"; // retrieved from external source... hardcoded for example's sake
    %>
    <jsp:forward page="<%=nextPage%>">
    <jsp:param name="message" value=' <%= "The result was" + result%>'/>
    </jsp:forward>
    Instead of using
    value= "The result was <%=result%>" you can use
    value= '<%= "The result was" + result%>'.
    Hope this helps

  • JSP (no java code), taglibs and dynamic list boxes

    Hi,
    Can anyone recommend a few examples of JSPs using Tag Libraries to represent a dynamic dropdown box in a form? We are trying to learn how to incorporate tag libs into our pages so we have no code on the JSPs. We currently have a JSP that uses dynamic dropdowns, but the all the code is in the JSP. Most examples we find use either static data or just output data into a table with taglibs. But our pages use many dropdowns, inputs, etc... for updates and inserts. We are using JSPs, servlets, and tags which will get data from EJB's (stateless and entity). (We are also using WEblogic Server 7.0 if that makes any difference) If you know of some good examples or tutorials that show how to accomplish this, it would GREATLY help us out!!
    Thanks!

    Check out Struts, they have an HTML taglib that does exactly what your talking about. http://jakarta.apache.org/struts

  • Custom taglib and inexplicable jsp compilation issue

    Can someone explain what could possibly be happening here? I have been working on this for two days to no avail.
    With the following configuration, my jsp behaves as I expect it to on Tomcat, but fails to compile both for Jetty and the Maven2 jspc plugin
    deepfij.tld
    <taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee [3]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
    <tlib-version>1.0</tlib-version>
    <short-name>deepfij</short-name>
    <uri>com.fijimf.deepfij</uri>
    <tag>
    <name>menuItem</name>
    <tag-class>com.fijimf.deepfij.web.tag.MenuItemTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
    <name>item</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    menubar.jsp
    <%@ taglib prefix="df" uri="/WEB-INF/tlds/deepfij.tld"%>
    <c:forEach var="page" items="${menuRootPages}">
    <df:menuItem item="${page}" />  
    </c:forEach>
    MenuItemTag.java
    package com.fijimf.deepfij.web.tag;
    .With the error: com.fijimf.deepfij.web.tag cannot be resolved to a type.
    BUT*, if I move MenuItemTag into the package com.fijimf.web, and correspondingly change the .tld, everything works as expected.
    Is this a bug, or is there a constraint in taglib packages I don't know about?
    Any guidance would be great, because I'd like to put classes where I want them.

    This is most likely a bug on the server. The JSP formatted Tag Files usually have a .tag extension on them ( [see tutorial|http://java.sun.com/javaee/5/docs/tutorial/doc/bnama.html] ). The server is probably looking at yyy.xxx.tag and trying to use it as if it was a Tag File named xxx.tag, rather than a package.

  • Jsps, xhtml and Internet Explorer

    Hi there,
    anoyone know this one?
    I have a jsp page written to the xhtml standard. It looks like this:
    <?xml version="1.0"?>
    <!--
    - Author(s):
    - Date:
    - Copyright Notice:
    - Description:
    -->
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:html="/WEB-INF/struts-html.tld"
    xmlns:bean="/WEB-INF/struts-bean.tld"
    xmlns:dt="http://jakarta.apache.org/taglibs/datetime-1.0"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:fmt="http://java.sun.com/jstl/fmt"
    version="1.2">
    <html:html xhtml="true">
    <head>
    </head>
    <body>
    </body>
    </html:html>
    </jsp:root>
    All seems fine. The page compiles properly and looks nice on every browser I've
    tried. Except Internet Explorer (v6), where it simply displays the XML source tree.
    I tried adding:
    <mime-mapping>
    <extension>jsp</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    (and simlarly for xhtml) to the web.xml (both the webapp one and the global one).
    I'm using tomcat 4.0.6 and java 1.4.1 (I can't easily upgrade these because this is what my client use).
    Has anyone seen this before?
    Many thanks,
    Graham

    maybe cuz you are missing the DOCTYPE declaration.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  • Jsp taglibs in include files not detected, throws errors, no code insight

    I have a jsp which is included in all the other jsp. it looks something like this
    taglibs.jsp
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    test.jsp
    <%@ include file="/jsp/menu/taglibs.jsp"%>
    <html>
         <head>
              <title>Tours</title>
         </head>
         <body>
    <form:form commandName="testCommand">
                   <form:hidden path="tour.firstname" id="tour.firstname" />
    and so on.
    I am having 2 problems
    1. the jsp editor show errors all over the place saying
    element path not expected
    element commandName not expected etc.
    2. no code insights.
    but if i include the taglib def in test.jsp it dosn't show any error and also provides code insights. but seldom do people include all taglibs in all jsps.
    is there a way for Jdeveloper to show code insights in jsp pages which includes a jsp or like xml schemas could be added at some place(tools-pref-xml schemas) and when used anywhere, would provide code insights.

    am not sure, try with this
    <jsp:include   .../>

  • Jsp taglib problems in J2ee server  of j2sdkee1.3

    Fresh from solving the problems with usebean in jsp, I again got a problem with the custom tags of JSP
    I am using Jdk1.3 and j2sdkee1.3, windows98
    The class file is stored in a package called my in the c:\j2sdkee1.3\lib\classes\my folder
    and the tld and jsp file stored in c:\j2sdkee1.3\public_html folder
    when I access the atm.jsp page, I got this error message
    A Servlet Exception Has Occurred
    org.apache.jasper.compiler.ParseException: End of content reached while more parsing required: tag nesting error?
    Here is the ATMJsp.tld code
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
         <tlibversion>1.0</tlibversion>
         <jspversion>1.1</jspversion>
         <shortname>ATMJsp</shortname>
         <info>a tag library for the atm details</info>
         <tag>
              <name>ATM</name>
              <tagclass>my.atmtag</tagclass>
              <bodycontent>JSP</bodycontent>
              <info>Outputs of the ATM Counter</info>
         </tag>
    </taglib>
    I try:
    When I put the <bodycontent> tags below the <info> tags, I got the error message that the tag doesn't allow "bodycontent" here
    I don't know what caused the problem ... is there some mistake in the above code?
    Include other file to make it more clear---* atm.jsp and atmtag.java
    atm.jsp
    <%@ page import="my.atmtag" %>
    <%@ taglib uri="ATMJsp.tld" prefix="atmjsp" %>
    <%@ page errorPage="errorpage.jsp" %>
    <!DocType HTML Public "-//W3C//DTD// HTML 4.0 Translational//EN">
    <html>
    <head></head>
    <body>
    <h3 align=center>ATM counters that need cash</h3>
    <table><tr>
    <td></td>
    <td><atmjsp:ATM></td>
    </tr>
    </body>
    </html>
    atmtag.java
    package my;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import java.io.*;
    import java.sql.*;
    import java.math.*;
    import java.util.*;
    //tag handler
    public class atmtag extends TagSupport
         Connection connect=null;
         Statement state=null;
         ResultSet result=null;
         public atmtag() throws ClassNotFoundException
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         public int doStartTag() throws JspTagException
              return EVAL_BODY_INCLUDE;
         public int doEndTag() throws JspTagException
              try
                   JspWriter out=pageContext.getOut();
                   connect=DriverManager.getConnection("jdbc:odbc:EarnestBank","","");
                   String strquery="select cCounter_id, cAddress, mCashBalance from Counter where mCashBalance<=10000";
                   state=connect.createStatement();
                   ResultSet result=state.executeQuery(strquery);
                   String sid=null;
                   String saddress=null;
                   String sbalance=null;
                   Vector v=new Vector();
                   while(result.next())
                        sid=result.getString(1);
                        saddress=result.getString(2);
                        sbalance=result.getString(3);
                        v.add(sid);
                        v.add(saddress);
                        v.add(sbalance);
                   for (int i=0; i<v.size();i++)
                        String str=(String)v.elementAt(i);
                        pageContext.getOut().write(str);
              catch(Exception ex)
              return EVAL_PAGE;
    Pls help me to get through this hurdle
    Thanks

    1) To handle <bodycontent> you should inherit from BodyTagSupport
    class
    2) You should use your bean like: <td><atmjsp:ATM/></td>
    with closing slash - it's bodyless tag - this mistake
    causes JSP compiler to report error
    Enjoy!
    Paul

  • JSP documents and namespaces

    I have an issue involving JSP documents (i.e. JSP pages that are
              well-formed XML documents). I am using namespaces on children elements
              of the <jsp:root> element, because my JSP page generates XML with
              namespaces. The simple fragment below illustrates this:
              <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
              version="1.2">
              <d:document xmlns:d="http://example.org/xml/document">
              <d:head>
              <d:title>Example</d:title>
              </d:head>
              <d:body>
              Some Text.
              </d:body>
              </d:document>
              </jsp:root>
              This example works with Tomcat 4 and Tomcat 5, but fails with WL
              8.1. I get an error like this:
              /example/my.jsp(20): no corresponding open tag for tag extension
              close: //[ ; Line: 20]
              probably occurred due to an error in /example/my.jsp line 20:
              </d:document>
              This seems to be a bug in the WebLogic JSP implementation. It should
              be possible to generate XML documents containing namespaces. The JSP
              1.2 spec is actually silent on this, but it says (JSP.5.2.2):
              "the root is where namespace attributes of taglibs will be inserted.
              All tag libraries used within the JSP document are represented in the
              root element through additional xmlns attributes."
              This to me implies that namespace declarations occurring elsewhere in
              the document are not interpreted as tag libs and therefore should be
              handled like regular tags.
              Any help is appreciated.
              -Erik
              

              "Erik Bruchez" <[email protected]> wrote in message
              news:[email protected]...
              > Thanks Nagesh,
              >
              > In passing, looking at the latest JSP 2.0 spec, I found out that there
              > may be an additional issue in the future, as the 2.0 spec allows for
              > tag libraries namespace declarations everywhere in the document. How
              > are you going to be able to generate XML documents with namespaces if
              > every namespace is necessarily bound to a tag library? The spec does
              > not seem to address this at all. I have emailed my feedback to the
              > JSR, but it would be interesting to have the opinion of WebLogic
              > developers on this.
              >
              > -Erik
              As far as i can remember, this doesn't restrict the namespaces in themselves
              i.e not attached to any taglibs. Given a namespace which is not resolved as
              a taglib, it will be considered a standard namespace no? .. Am i missing
              something. Also which section and which PFD version of the spec are you
              looking at? It would be great if you can give a little more detail about the
              issue so it can be fixed in the spec if possible..
              I would also be interested in knowing how you are using the Jsp documents
              (in xml format) in general. (since I'm trying to get an insight into the
              various ways in which jsp Docs are being used by customers)
              Nagesh
              >
              > Nagesh Susarla <[email protected]> wrote in message
              news:<[email protected]>...
              > > Hi Erik,
              > >
              > > Indeed this does look like a bug in the wls jsp container. Attributes
              > > with ':' in them are not being lexed correctly. I've opened CR111972 to
              > > track this issue, so please contact [email protected] for necessary
              patches.
              > >
              > > thanks
              > > Nagesh
              > >
              > > Erik Bruchez wrote:
              > > > I have an issue involving JSP documents (i.e. JSP pages that are
              > > > well-formed XML documents). I am using namespaces on children elements
              > > > of the <jsp:root> element, because my JSP page generates XML with
              > > > namespaces. The simple fragment below illustrates this:
              > > >
              > > > <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
              > > > version="1.2">
              > > > <d:document xmlns:d="http://example.org/xml/document">
              > > > <d:head>
              > > > <d:title>Example</d:title>
              > > > </d:head>
              > > > <d:body>
              > > > Some Text.
              > > > </d:body>
              > > > </d:document>
              > > > </jsp:root>
              > > >
              > > > This example works with Tomcat 4 and Tomcat 5, but fails with WL
              > > > 8.1. I get an error like this:
              > > >
              > > > /example/my.jsp(20): no corresponding open tag for tag extension
              > > > close: //[ ; Line: 20]
              > > > probably occurred due to an error in /example/my.jsp line 20:
              > > > </d:document>
              > > >
              > > > This seems to be a bug in the WebLogic JSP implementation. It should
              > > > be possible to generate XML documents containing namespaces. The JSP
              > > > 1.2 spec is actually silent on this, but it says (JSP.5.2.2):
              > > >
              > > > "the root is where namespace attributes of taglibs will be inserted.
              > > > All tag libraries used within the JSP document are represented in the
              > > > root element through additional xmlns attributes."
              > > >
              > > > This to me implies that namespace declarations occurring elsewhere in
              > > > the document are not interpreted as tag libs and therefore should be
              > > > handled like regular tags.
              > > >
              > > > Any help is appreciated.
              > > >
              > > > -Erik
              

  • FLEX and JSP

    so for my senior design project i designed a web project using java servlets and JSP pages. For one part of the project to visualize some data i used FLEX to create GANTT Charts. Now that it's done i was looking into how to embed that flex code into JSP page and i found on ADOBE website links for taglibs, however right now it redirects me into a page of Adobe LiveCycle , which cost a lot of money.
    Is there another way to embed flex into jsp? or some other way to get just the taglib for flex?
    Thank You

    It depends on how Flex is getting the data, and how it's generated. If you refresh the page, then the Flex app will be reset, and won't have any knowledge of previous data. One thing you could do is store the data on the server and access it via some web-service calls (eg AMF or REST). The server could manage the user's session, store data, and generate or retrieve previous data.

  • Java mail and jsp -HELP!! HELP!!

    Hi all
    I have a simple email module with a jsp page and a html page I am trying to connect to a yahoo smtp server and send a mail from the webpage to the smtp server - I am getting an Authentication required error.
    error ##
    org.apache.jasper.JasperException: Sending failed;
    nested exception is:
         class javax.mail.MessagingException: 530 authentication required - for help go to http://help.yahoo.com/help/us/sbc/dsl/mail/pop/pop-11.html
    Can anyonne tell me how to use a simple smtp email facility
    how to use an authenticator in the jsp
    ciao
    laodingdockjavaguy

    It's required that you authentificate yourself at the smpt server
    The following snipplet sends a msg using the smtp protocol.
    Transport tr = session.getTransport("smtp");
    tr.connect(smtphost, username, password);
    msg.saveChanges();     // don't forget this
    tr.sendMessage(msg, msg.getAllRecipients());
    tr.close();If this still fails You can also try to set the property mail.smtp.auth to true.
    mail.smtp.auth      boolean      If true, attempt to authenticate the user using the AUTH command. Defaults to false.see also http://java.sun.com/products/javamail/1.3/docs/javadocs/com/sun/mail/smtp/package-summary.html
    for a complete description of the properties supported by the smpt transport.
    hope it helps

  • How to use taglibs in JSP for Database access

    Hi
    Could any one please tell me how to use taglibs in JSP for Database access
    with regrds
    Jojo

    This is a sample how to connect to a MySQL database with JSTL 1.0:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>JSTL MySQL</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <c:catch var="e">
    <sql:setDataSource var="datasource" url="jdbc:mysql://Your_Server_Name_Here/You_Schema_Here"
                           user="Your_Username_Here" password="Your_Password_Here"
                           driver="com.mysql.jdbc.Driver"/>
    <c:out value="datasource= ${datasource},  Class = ${driver.class}"/>
    <br />
    <br />
    <sql:query var="deejays" dataSource="${datasource}">SELECT * FROM Your_Table_Name_Here</sql:query>
    <table>
    <%-- Get the column names for the header of the table --%>
    <c:forEach var="columnName" items="${deejays.columnNames}"><th><c:out value="${columnName}"/></th></c:forEach>
    <tbody>
    <%-- Get the value of each column while iterating over rows --%>
    <c:forEach var="row" items="${deejays.rows}">
      <tr><c:forEach var="column" items="${row}">
            <td><c:out value="${column.value}"/></td>
          </c:forEach>
      </tr>
    </c:forEach>
    </tbody>
    </table>
    </c:catch>
    <br />
    <br />
    <c:if test="${e!=null}"><span class="error">Error</span>�
      <c:out value="${e}" />
    </c:if>
    </body>
    </html>And this thread might help you:
    http://forum.java.sun.com/thread.jspa?threadID=639471&tstart=44

Maybe you are looking for