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.

Similar Messages

  • 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.

  • JDeveloper 3.1 and JSP problems

    Hello everybody.
    I present myself. I am a French student in computer sciences who makes a training course in a French company. (You will excuse the bad quality of my English)
    I have some difficulties in the use of Oracle JDeveloper tool.
    1st problem:
    I encountered this problem during the creation of a JSP page for a simple Intranet application connected to an Oracle database.
    JDeveloper doesnt want to take into account the fact that one of my tables has two primary (composite) keys;(Each of these two keys is primary key of another table). That results on the one hand in an error during the loading of the default edition form (" JBO-25030: Failed to find or invalidate owning entity ") and in addition by impossibility of consulting the recordings of this table according to one of the two key parameters (selected in RowSetBrowser). Nevertheless, this last aspect works within the Oracle Business Component Browser.
    2nd problem:
    Imagine, for example, the following simplified conceptual diagram:
    Racks ---> Files ---> Sheets (they are tables)
    How on a JSP page, can I display in the easiest way (with a JSNavigatorTab and a RowSetBrowser), the recordings of the table Sheets of a particular File, without to use a selection at the table Racks level.
    (You choose directly, with a ComboBox or a RowSetBrowser, a File to display all the corresponding Sheets, without to choose a Rack before.)
    In fact, I try to have an application as simple and ergonomic as possible.
    I thank all those who will be able to inform me on these obscure points which slow down my project considerably.
    Regards.
    Guillaume Vidal
    null

    Hi,
    * For your 1st problem, try to uncheck the "composite association" checkbox in the association object linking your tables together, should work better.
    * For the second one,
    when you create the application module containing the rack/file and sheet views, add the file view at root level (i.e do not use the view link relationship, which would include it as a detail view for the racks view), then add the sheet view through the file/sheet viewLink.
    This way you'll be able to browse the entire file and sheet list in a basic master/detail view.
    Good luck, Remi
    by Guillaume Vidal:
    Hello everybody.
    I present myself. I am a French student in computer sciences who makes a training course in a French company. (You will excuse the bad quality of my English)
    I have some difficulties in the use of Oracle JDeveloper tool.
    1st problem:
    I encountered this problem during the creation of a JSP page for a simple Intranet application connected to an Oracle database.
    JDeveloper doesnt want to take into account the fact that one of my tables has two primary (composite) keys;(Each of these two keys is primary key of another table). That results on the one hand in an error during the loading of the default edition form (" JBO-25030: Failed to find or invalidate owning entity ") and in addition by impossibility of consulting the recordings of this table according to one of the two key parameters (selected in RowSetBrowser). Nevertheless, this last aspect works within the Oracle Business Component Browser.
    2nd problem:
    Imagine, for example, the following simplified conceptual diagram:
    Racks ---> Files ---> Sheets (they are tables)
    How on a JSP page, can I display in the easiest way (with a JSNavigatorTab and a RowSetBrowser), the recordings of the table Sheets of a particular File, without to use a selection at the table Racks level.
    (You choose directly, with a ComboBox or a RowSetBrowser, a File to display all the corresponding Sheets, without to choose a Rack before.)
    In fact, I try to have an application as simple and ergonomic as possible.
    I thank all those who will be able to inform me on these obscure points which slow down my project considerably.
    Regards.
    Guillaume Vidal
    null

  • 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

  • Struts and JSP problem..help needed

    Hi,
    I am trying to use request.setParameter("formatName") from the JSP page into the ACtion class to display the user entered values.
    I have my struts action classes tagged to be in session scope since the UI is a wizard and i want the values to be carried on until they click finish. on the wizard.
    I want the formatName floating across the wizard, I have another value called."Category" floating since its a dynamically generated variable using the formbean.
    ***************ACTION class****************
    public class CreateFormatReportDefinitionAction extends Action
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
         final Logger logger = Logger.getLogger(this.getClass());
    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value
    ClarityReportDefinitionFormBean rdFormBean = (ClarityReportDefinitionFormBean) form;
              HttpSession session = request.getSession();
              List fList = new ArrayList();
              FormatDAO fDAO = new FormatDAO();
              Format fmt = null;
    try {
              logger.log(Level.INFO, "Entering CreateFormatReportDefinition Action...");
              Person person = PersonUtil.getCurrentUser(request);
              logger.debug("Category is: "+rdFormBean.getCategory());
              List formats = fDAO.findFormatsForCategory(rdFormBean.getCategory());
              for(int i=0;i < formats.size(); i++) {
                   fmt = (Format)formats.get(i);
              if(fmt.getOwner().getEmailaddr().equals(person.getEmailaddr())){
              fList.add(fmt);
              rdFormBean.setUserFormatList(fList);
              logger.log(Level.DEBUG,"sessionObject for formName is: "+session.getAttribute("formatName"));
    } catch(Exception e) {
    // Report the error using the appropriate name and ID.
    errors.add("name", new ActionError("id"));
    // If a message is required, save the specified key(s)
    // into the request for use by the <struts:errors> tag.
    if (!errors.isEmpty()) {
    saveErrors(request, errors);
    // Write logic determining how the user should be forwarded.
    forward = mapping.findForward("success");
    // Finish with
    return (forward);
    ***********JSP form for the class****************
    <html:form action="/createFilterAction" >
    <table>
    <tr><td>
    <html:text property="formatName" />
    </td></tr>
              <tr>
                   <td>
    <html:select property="myFormats" onchange="insertSelectedMyFormat()">
    <html:option value="">Select user Formats</html:option>
    <c:forEach var="formats" items="${reportDefFormBean.userFormatList}">
    <html:option value="${formats.name}"><c:out value="${formats.name}"/></html:option>
    </c:forEach>
    </html:select>
    </td>
              </tr>
    </table>
    </html:form>
    ***********JAVASCRIPT**********
    var box = document.reportDefFormBean.myFormats;
    function insertSelectedMyFormat()
         var hisFormat = box.options[box.selectedIndex].value;
         document.reportDefFormBean.formatName.value = hisFormat;
    ********STRUTS_CONFIG.XML*****************
    <form-beans>
         <form-bean name="reportDefFormBean"
                   type="com.ibm.ads.reports.web.formbeans.ClarityReportDefinitionFormBean"></form-bean>
    </form-beans>
    <action name="reportDefFormBean" path="/createFormatReportDefinition"
                   type="com.ibm.ads.reports.web.actions.reportDefinition.CreateFormatReportDefinitionAction"
                   scope="session" validate="false">
                   <forward name="success" path="/createFormatReportDefinition.jsp"/>
    </action>
    I am getting a null for Session.getAttribute("formatName") or even if i change the scope to request, i use request.getPArameter("formatName"), i get null again.
    I dunno what iam missing in this regard, but if anyone has found anything wrong with my code...please help me out.
    any time spent will be appreciated.
    Thank you and regards,
    dev

    Hi,
    I am trying to use request.setParameter("formatName") from the JSP page into the ACtion class to display the user entered values.
    I have my struts action classes tagged to be in session scope since the UI is a wizard and i want the values to be carried on until they click finish. on the wizard.
    I want the formatName floating across the wizard, I have another value called."Category" floating since its a dynamically generated variable using the formbean.
    ***************ACTION class****************
    public class CreateFormatReportDefinitionAction extends Action
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    final Logger logger = Logger.getLogger(this.getClass());
    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value
    ClarityReportDefinitionFormBean rdFormBean = (ClarityReportDefinitionFormBean) form;
    HttpSession session = request.getSession();
    List fList = new ArrayList();
    FormatDAO fDAO = new FormatDAO();
    Format fmt = null;
    try {
    logger.log(Level.INFO, "Entering CreateFormatReportDefinition Action...");
    Person person = PersonUtil.getCurrentUser(request);
    logger.debug("Category is: "+rdFormBean.getCategory());
    List formats = fDAO.findFormatsForCategory(rdFormBean.getCategory());
    for(int i=0;i < formats.size(); i++) {
    fmt = (Format)formats.get(i);
    if(fmt.getOwner().getEmailaddr().equals(person.getEmailaddr())){
    fList.add(fmt);
    rdFormBean.setUserFormatList(fList);
    logger.log(Level.DEBUG,"sessionObject for formName is: "+session.getAttribute("formatName"));
    } catch(Exception e) {
    // Report the error using the appropriate name and ID.
    errors.add("name", new ActionError("id"));
    // If a message is required, save the specified key(s)
    // into the request for use by the <struts:errors> tag.
    if (!errors.isEmpty()) {
    saveErrors(request, errors);
    // Write logic determining how the user should be forwarded.
    forward = mapping.findForward("success");
    // Finish with
    return (forward);
    }***********JSP form for the class****************
    <html:form action="/createFilterAction" >
    <table>
    <tr><td>
    <html:text property="formatName" />
    </td></tr>
    <tr>
    <td>
    <html:select property="myFormats" onchange="insertSelectedMyFormat()">
    <html:option value="">Select user Formats</html:option>
    <c:forEach var="formats" items="${reportDefFormBean.userFormatList}">
    <html:option value="${formats.name}"><c:out value="${formats.name}"/></html:option>
    </c:forEach>
    </html:select>
    </td>
    </tr>
    </table>
    </html:form>***********JAVASCRIPT**********
    var box = document.reportDefFormBean.myFormats;
    function insertSelectedMyFormat()
    var hisFormat = box.options[box.selectedIndex].value;
    document.reportDefFormBean.formatName.value = hisFormat;
    }********STRUTS_CONFIG.XML*****************
    <form-beans>
    <form-bean name="reportDefFormBean"
    type="com.ibm.ads.reports.web.formbeans.ClarityReportDefinitionFormBean"></form-bean>
    </form-beans>
    <action name="reportDefFormBean" path="/createFormatReportDefinition"
    type="com.ibm.ads.reports.web.actions.reportDefinition.CreateFormatReportDefinitionAction"
    scope="session" validate="false">
    <forward name="success" path="/createFormatReportDefinition.jsp"/>
    </action>I am getting a null for Session.getAttribute("formatName") or even if i change the scope to request, i use request.getPArameter("formatName"), i get null again.
    I dunno what iam missing in this regard, but if anyone has found anything wrong with my code...please help me out.
    any time spent will be appreciated.
    Thank you and regards,
    dev

  • Jsp and JPanel problem

    Hello. I've been to this forum many times, but have always been a bit gunshy about posting anything of my own. Now I have a problem I haven't seen before, so here goes. I have a JPanel in a java program that has all sorts of other componants added to it. I am trying to display the whole thing in a jsp page. This is what I am doing in the java file to return the image ("display" is the JPanel):
    public byte[] getImage(){
        int w = display.getWidth();
        int h = display.getHeight();
        BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        display.paint(img.createGraphics());
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        ImageIO.write(img, "jpeg", os);
        return os.toByteArray();
    }and then in the jsp page I say:
    <%@ page contentType="image/jpeg" %>
    <%@ page import="myPackage.MyClass" %>
    <%
         MyClass picture = new MyClass();
         byte[] b = picture.getImage();
         OutputStream os;
         os = response.getOutputStream();
         os.write(b);
         os.flush();
    %>And the problem is that the page is displaying a blank JPanel and none of the componants that were added to it. If I save the the JPanel as a jpeg in the java program, though, it does contain all the componants, so I am not sure what I am doing wrong here. If there is some way to get the all the JPanel componants returned, that would be great to know. Thanks for any help.

    nope, that didn't work.
    Maybe I am going about solving the problem all wrong. The JPanel and its componants are kind of like a template. When a user of the system submits their information it automatically puts the data into the template and displays it on screen as a jpg. It works when I save the jpg as a file from the java program but not when i send the byte array to the jsp server. It just shows the blank panel....
    Is there a better way to go about doing this?

  • JSP and Tomcat Problem

    Folks,
    My apologies if this is off-topic for this forum, but I've been having this problem using Tomcat and JSP. I'm fairly new to Java.
    Basically, I'm writing a webapp that uses servlets and JSP together. The servlet and backend classes all compile fine. Now, basic frontend page is called Console.jsp, and one of the commands that it runs is <%@ page import="DJUser">
    Here's the problem: Console.jsp is in $CATALINA_HOME/webapp/
    DJUser (and the rest of the classes I'm using) are in $CATALINA_HOME/webapp/WEB-INF/classes
    When I attempt to run Console.jsp I get this error:
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    The import DJUser cannot be resolved
    An error occurred at line: 9 in the jsp file: /Console.jsp
    Generated servlet error:
    DJUser cannot be resolved to a type
    An error occurred at line: 11 in the jsp file: /Console.jsp
    Generated servlet error:
    user cannot be resolved
    An error occurred at line: 11 in the jsp file: /Console.jsp
    Generated servlet error:
    DJUser cannot be resolved to a type
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    The ROOT CAUSE is listed as:
    java.lang.ClassNotFoundException: org.apache.jsp.Console_jsp
         java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         java.security.AccessController.doPrivileged(Native Method)
         java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:133)
         org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65)
         org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:596)
         org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    I'm running Tomcat 5.5.12 on Mac OS X 10.4. Could this be a permissions issue somehow? For right now (testing purposes only) I have tomcat running under my (non root) account.
    I've been scouring the web for a while, and I can't really find anything on this. I'd appreciate any help you could give me.
    Thanks!
    Dylan

    Put the DJUser java file in a package (say com.myClasses) and recompile. Then put the DJUser class file under the WEB-INF/classes directory in the proper package structure (WEB-INF/classes/com/myClasses/DJUser). Stop and restart the server to pick up the new classes. Make sure to change the jsp import statement ( <%@ page import="com.myClasses.DJUser">)

  • 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.

  • Need help with taglib and javascript issue

    I have created two WebSphere portlets (using WebSphere Application Studio), which exchange information by using click-to-action. I have added the click-to-action functionality programatically.
    On my source portlet jsp page I took the java code which generates the click-to-action javascript and added it to a taglib I created. The problem is that now the click-to-action functionality doesn't work.
    When I look at the source code in the browser the javascript and the onClick code is there as it should be, but when I click on the hyperlink, the click-to-action menu is not displayed.
    If I take the java code out of the taglib and put it back into the jsp page it works no probs and on inspection of the generated code it is exactly the same as the code generated by the taglib version.
    I have noticed that when I click the hyperlink to fire the onClick event I get an error message in the browser but when I go to the line number given in the error message, there is no code on that line.
    Any ideas why it doesn't work when put in a taglib?
    Thanks in advance,
    A.

    There can be a million reasons
    1) What is the exact error line?
    2) Try debugging in Mozilla instead of IE. Mozilla's javascript debugger is much better. In IE you may have to look more at the error message then the line it gives you to id where the error occurs.

  • Hot swap and JSP debugging for Weblogic in exploded format?

    Hi,
    I'm trying to use JDeveloper for JSF development to be deployed to a weblogic server.
    I must say JDeveloper is a great tool for JSF development as none of the free IDE in the market can do what JDeveloper does.
    However, I have a question on hot swap and JSP debugging.
    I have managed to setup JDeveloper to debug my JSF application deploy to my Weblogic server's applications folder in exploded format.
    I can step through the java code.
    However, I didn't manage to do a hot swap and the break point set in the JSF-JSP does not seems to take effect.
    I would appreciate any advice on the problem.
    Thanks.
    Han Ming

    How did you setup the server to handle exploded format? Appreciate the help. Sorry can't help with your question though.
    Thnx.
    Soni

  • 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.

  • 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>

  • Dbc file and Jsp error

    Dear all,
    I am trying to do multinode installtion on AIX 5.3 HACMP . During post installation i am getting this error.
    Dbc file and Jsp error
    Updating Server Security Authentication
    java.sql.SQLException: Io exception: Invalid number format for port number
    Database connection to jdbc:oracle:thin:@host_name:port_number:database failed
    Updating Server Security Authentication failed with exit code 1
    adgendbc.sh exiting with status 1
    ERRORCODE = 1 ERRORCODE_END
    SQLPLUS Executable : /mglapp/oramgl/mglora/8.0.6/bin/sqlplus
    SP2-0642: SQL*Plus internal error state 2165, context 4294967295:0:0
    Unable to proceed
    ERRORCODE = 1 ERRORCODE_END
    Thanks in advance

    Maybe you have problem with the date format, please ensure that NLS_DATE_FORMAT env variable is set to a valid value.
    Please view SP2-0642: Sql*Plus Internal Error State 2165, Context 4294967295:0:0 Doc ID: Note:396154.1.
    Hope it helps.
    Adith

  • Differences between WL or Netscape for Servlets and JSP's

    What are the advantages / disadvantages of running Servlets under WL,
              vs. say, running them in Netscape's servlet engine? Assuming EJB
              container is run separately, either one of these could make calls to the
              WL EJB server, so perhaps it would be simpler and faster to run servlets
              and JSP's under Netscape, and have them call via t3 into a weblogic
              server for EJB's?
              Thoughts
              david
              David Michaels <[email protected]>
              Director of Technology
              ShockMarket Corporation (650) 330-4665
              [david.vcf]
              

    David,
              One of the major reasons to run your servlets on Weblogic is that we have an
              optimization that allows us to pass by reference objects when calling from
              servlets to EJB. This makes things much faster.
              A number of our customers, in addition, have seen performance problems when
              using other servlet engines. It just seems to cause problems due to their
              threading models etc.
              Finally, our servlet engine is by far the most mature and robust on the
              market today. Our JSP implementation is also the best in terms of
              performance.
              Thanks,
              Michael
              Michael Girdley
              WLS Product Manager
              David Michaels <[email protected]> wrote in message
              news:[email protected]..
              > What are the advantages / disadvantages of running Servlets under WL,
              > vs. say, running them in Netscape's servlet engine? Assuming EJB
              > container is run separately, either one of these could make calls to the
              > WL EJB server, so perhaps it would be simpler and faster to run servlets
              > and JSP's under Netscape, and have them call via t3 into a weblogic
              > server for EJB's?
              >
              > Thoughts
              >
              > david
              >
              > --
              > David Michaels <[email protected]>
              > Director of Technology
              > ShockMarket Corporation (650) 330-4665
              >
              >
              

  • 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