Bean not working in jsp

OK, maybe I'm oversharing, but I want to be thorough. Note I asked this question a different way using very different code.
Here's my jsp file - myq.jsp
<%@ page language="java" import="java.util.*,com.serco.inquire.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="inq" tagdir="/WEB-INF/tags" %>
<inq:displayCollection>
<jsp:attribute name="mgr">Chris Novish</jsp:attribute>
</inq:displayCollection>Here's displayCollection.tag used by that jsp:
<%@ tag body-content="scriptless" import="com.serco.inquire.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="mgr" required="true" %>
<jsp:useBean id="irc" scope="session" class="com.serco.inquire.IrCollection">
  <jsp:setProperty name="irc" property="mgrid" value="${mgr}" />
</jsp:useBean>
${irc.size} | ${irc.mgrid}Here's the java class IrCollection (used as a bean in the tag):
package com.serco.inquire;
import java.sql.*;
import java.util.*;
public class IrCollection {
     public ArrayList iRecords = new ArrayList<InquireRecord>();
     public int size;
     public String mgrid;
     public irCollection() {
          super();
     public void populateCollection() {
          try {
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               String filename = "inquire.mdb";
               String database = "jdbc:odbc:Driver={Microsof Access Driver (*.mdb)};DBQ=";
               database+= filename.trim() + ";DriverID=22;READONLY=true}";
               Connection con = DriverManager.getConnection( database ,"","");
               Statement s = con.createStatement();
               s.execute ("SELECT * FROM inquiries WHERE manager = '" + this.mgrid + "'");
               ResultSet rs = s.getResultSet();
               int cur;
               while (rs.next()) {
                    cur = rs.getRow()-1;
                    InquireRecord localIR = new InquireRecord();
                    int curID = rs.getInt("ID");
                    localIR.setID(curID);
                    String cursub = rs.getString("submitter");
                    localIR.setSubmitter(cursub);
                    this.iRecords.add(cur, localIR);
               con.close();
               this.size = iRecords.size();
          catch (Throwable e) {
               System.out.println(e);
     public int getSize () {
          return this.size;
     public void setMgrid(String datum) {
          this.mgrid = datum;
          this.populateCollection();
     public String getMgrid() {
          return this.mgrid;
}and here's the InquireRecord java class used by IrCollection:
package com.serco.inquire;
public class InquireRecord {
     private int ID;
     private String submitter;
     public InquireRecord() {
          super();
     public InquireRecord(String asubmitter) {
          this.submitter = asubmitter;
     public int getID(){
          return this.ID;
     public void setID(int datum) {
          this.ID = datum;
     public String getSubmitter() {
          return this.submitter;
     public void setSubmitter(String datum) {
          this.submitter = datum;
}The JSP does this: set the mgr variable, which is passes to the tag, the tag then creates an instance of IrCollection using that mgr variable. (Yes, putting that populateCollection() method call in the setMgrid() method is probably Bad Practice, but it works, usually). The IrCollection objects builds an ArrayList of InquireCollection objects from an Access database. It then sets it's size property based on how many InquireCollection instances it put into the ArrayList. Once that's all done, the tag spits out 2 things: The size property and the mgrid property.
When I view the JSP, it gives me 0 for the size and Chris Novish for the mgrid.
I think this could be one of the following:
*Not finding any matching records of the database
*Not actually executing the populateCollection() method
*some how forgetting the information it put into that ArrayList?
I"m sure there's another possibility, but I don't know.
Here's what gets me. Here's a test class I made called TestCollection:
{code}package com.serco.inquire;
import java.util.*;
import java.text.*;
public class TestCollection {
     public static void main(String[] args) {
          IrCollection myCollection = new IrCollection();
          myCollection.setMgrid("Chris Novish");
          System.out.println(myCollection.getSize());
          System.out.println(myCollection.getMgrid());
}{code}
if I run that I get a size of 4 and a mgrid of Chris Novish.
Same data in, and it works as expected.
So... why won't JSP do it?

You have defined a session scope for that bean. You have to make sure that the bean is instantiated by this jsp and not earlier. If the bean is located in the session because it was set earlier, then the body tags within useBean are not evaluated.
Look here - http://java.sun.com/products/jsp/tags/syntaxref.fm14.html#8865
An easy way to test it would be to change the scope of the bean to request.
ram.

Similar Messages

  • Javascript is not working in JSP

    Hi everybody,
    My javascript is not working in JSP.I m not able to fix this problem.Please tell where the problem in code.
    thx in advance.
    <%@page import="javax.servlet.http.*" %>
    <%@page import="java.sql.*" %>
    <html>
    <head>
    <script type="text/javascript" >
    funtion checkentries()
    if(document.LForm.uname.value==null || document.LForm.upassword.value==null)
    alert("Please fill all entries")
    else
    document.LForm.submit()
    </script>
    </head>
    <body>
    <table width=100% height=100% valign="center" align="center" border=0>
    <tr height=10% ><td>
    <%@ include file="Header.jsp" %>
    <hr>
    </td></tr>
    <tr height=1% width=100%>
    <td align=right>Register
    <hr>
    </td>
    </tr>
    <tr height=77% width=100% ><td>
    <table>
    <tr><td width=65%>
    </td>
    <td bgcolor="black" width="1" ></td>
    <td align="right" valign="top" >
    <form method="POST" action="/EIS/Home.do" name="LForm">
    User Name: <input type="text" align=right name="uname"><br>
    Password: &nbsp&nbsp&nbsp<input type="password" name="upassword"><br>
    <input type="submit" name="submit" value="Submit" onclick="checkentries()">
    </td>
    </tr>
    </table>
    </td></tr>
    <tr height=10% ><td>
    <hr>
    <%@ include file="Footer.jsp" %>
    </td></tr>
    </table>
    </body>
    </html>

    in this part:
    if(document.LForm.uname.value==null || document.LForm.upassword.value==null)should be:
    if(document.LForm.uname.value=="" || document.LForm.upassword.value=="")or
    if(document.LForm.uname.value.length==0 || document.LForm.upassword.value.length==0)

  • Urgent: SAX parser bean is not working in JSP page

    Hi All,
    I have created a bean "ReadAtts" and included into a jsp file using
    "useBean", It is not working. I tried all possibilities. But Failed Plz Help me.
    Below are the details:
    Java Bean: ReadAtts.java
    package sax;
    import java.io.*;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import java.util.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.ParserConfigurationException;
    public class ReadAtts extends DefaultHandler implements java.io.Serializable
         private Vector attNames = new Vector(); //Stores all the att names from the XML
         private Vector attValues = new Vector();
         private Vector att = new Vector();
         private Locator locator;
         private static String start="",end="",QueryString="",QString1="",QString2="";
    private static boolean start_collecting=false;
         public ReadAtts()
         public Vector parse(String filename,String xpath) throws Exception
    QueryString=xpath;
         StringTokenizer QueryString_ST = new StringTokenizer(QueryString,"/");
         int stLen = QueryString_ST.countTokens();
         while(QueryString_ST.hasMoreTokens())
              if((QueryString_ST.countTokens())>1)
              QString1 = QueryString_ST.nextToken();
    else if((QueryString_ST.countTokens())>0)
                   QString2 = QueryString_ST.nextToken();
         SAXParserFactory spf =
    SAXParserFactory.newInstance();
    spf.setValidating(false);
    SAXParser saxParser = spf.newSAXParser();
    // create an XML reader
    XMLReader reader = saxParser.getXMLReader();
    FileReader file = new FileReader(filename);
    // set handler
    reader.setContentHandler(this);
    // call parse on an input source
    reader.parse(new InputSource(file));
         att.add("This is now added");
         //return attNames;
    return att;
    public void setDocumentLocator(Locator locator)
    this.locator = locator;
    public void startDocument() {   }
    public void endDocument() {  }
    public void startPrefixMapping(String prefix, String uri) { }
    public void endPrefixMapping(String prefix) {  }
    /** The opening tag of an element. */
    public void startElement(String namespaceURI, String localName,String qName, Attributes atts)
    start=localName;
    if(start.equals(QString2))
    start_collecting=true; //start collecting nodes
    if(start_collecting)
    if((atts.getLength())>0)
    for(int i=0;i<=(atts.getLength()-1);i++)
    attNames.add((String)atts.getLocalName(i));
    attValues.add((String)atts.getValue(i));
    /** The closing tag of an element. */
    public void endElement(String namespaceURI, String localName, String qName)
    end = localName;
    if(end.equals(QString2))
         start_collecting=false; //stop colelcting nodes
    /** Character data. */
    public void characters(char[] ch, int start, int length) { }
    /** Ignorable whitespace character data. */
    public void ignorableWhitespace(char[] ch, int start, int length){ }
    /** Processing Instruction */
    public void processingInstruction(String target, String data) { }
    /** A skipped entity. */
    public void skippedEntity(String name) { }
    public static void main(String[] args)
    String fname=args[0];
    String Xpath=args[1];
    System.out.println("\n from main() "+(new ReadAtts().parse(fname,Xpath)));
    //System.out.println("\n from main() "+new ReadAtts().attNames());
    //System.out.println("\n from main() "+new ReadAtts().attValues());
    JSP File:
    <%@ page import="sax.*,java.io.*,java.util.*,java.lang.*,java.text.*;" %>
    <jsp:useBean id="p" class="sax.ReadAtts"/>
    Data after Parsing is.....
    <%=p.parse"E:/Log.xml","/acq/service/metrics/system/stackUsage")%>
    Expected Output:
    The jsp file should print all the vector objects from the "ReadAtts" bean
    Actual Output:
    Data after Parsing.......[]
    Thanks for your time.....
    Newton
    Bangalore. INDIA

    the problem is not because of java code insdie jsp page
    I have removed all things but the form and it is still not working
    here is the modified code:
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.print("addBTN");
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input name="addBTN" type="submit" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

  • Filter does not work with *.jsp URL pattern???

    Hi All,
    I am, by no means, very good at JSF or Java. I have looked at various forum posts on here for ways to implement a security filter to intercept requests to pages that first require one to be logged in, and if not, redirect them to the login page. Yes, I know a lot of you have heard this many times before, and I'm sorry to bring it up again.
    BUT, from the guidance of other posts, I have got a filter that works fine when the url pattern is set to "/faces/*" or "/<anything>/*", however it won't work for "*.jsp" or "*.<anything>"
    My filter is as follows:
    package test.security;
    import javax.faces.context.FacesContext;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.http.HttpSession;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SecurityFilter implements Filter{
        /** Creates a new instance of SecurityFilter */
        private final static String FILTER_APPLIED = "_security_filter_applied";
        public SecurityFilter() {
        public void init(FilterConfig filterConfig) {
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException{
            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse res = (HttpServletResponse)response;
            HttpSession session = req.getSession();
            String requestedPage = req.getPathTranslated();
            String user=null;
            if(request.getAttribute(FILTER_APPLIED) == null) {
                //check if the page requested is the login page or register page
                if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */
                    //set the FILTER_APPLIED attribute to true
                    request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
                    //Check that the session bean is not null and get the session bean property username.
                    if(((test.SessionBean1)session.getAttribute("SessionBean1"))!=null) {
                        user = ((test.SessionBean1)session.getAttribute("SessionBean1")).getUsername();
                    if((user==null)||(user.equals(""))) {
                       // try {
                     //       FacesContext.getCurrentInstance().getExternalContext().redirect("Page1.jsp");
                      //  } catch (ServletException ex) {
                      //      log("Error Description", ex);
                        res.sendRedirect("../Page1.jsp");
                        return;
            //deliver request to next filter
            chain.doFilter(request, response);
        public void destroy(){
    }My web.xml declaration for the filter is:
    <filter>
      <description>Filter to check whether user is logged in.</description>
      <filter-name>SecurityFilter</filter-name>
      <filter-class>test.security</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>SecurityFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    Note: I have also tried this with <url-pattern>*.jsp</url-pattern> for the filter mapping in place of the Faces Servlet
    My web.xml declaration for the url pattern is:
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>Which JSC/NetbeansVWP automatically creates a "JSCreator_index.jsp" which has:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root  version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page">
      <jsp:forward page="Page1.jsp"/>
    </jsp:root>When run, this causes an Error 500 in the browser and a NullPointerException in SecurityFilter.java on the line:
    if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */I think I'm missing something that would be obvious to anyone who knows better than me. Any ideas?

    Dear Ginger and Boris,
    thanks for the information - the problem seems to ocur in EP7 as well, Boris told me it is fixed in SP15. We are on SP14 now, so there is hope !
    actually the information in the oss note stated above is also true, as we have an Oracle DB. On a similar demo system (only difference is SQL DB) the hyphen search works !
    best regards, thank you !
    Johannes

  • HTML multipart form is not working in jsp page

    Hi
    i have jsp page, has a HTML from with file upload field , when i click the send button , nothing happened as if the button did not submit the form. ie the message at line 12 is not printed out.
    can any one help please.
    <%@ page errorPage="..\error\error.jsp" %>
    <%@ page pageEncoding="windows-1256" %>
    <%@ page language="java" import="javazoom.upload.*,java.util.*,java.sql.ResultSet" %>
    <jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" >
      <jsp:setProperty name="upBean" property="folderstore" value="<%=request.getRealPath("thuraya//uploads")%>"  />
    </jsp:useBean>
    <jsp:useBean id="dbc" class="mypackage.DBConnection" scope="session" />
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.println("addbtn");
            //do upload file + insert in database
             if (MultipartFormDataRequest.isMultipartFormData(request))
             // Uses MultipartFormDataRequest to parse the HTTP request.
             MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);
             String todo = null;
             if (mrequest != null) todo = mrequest.getParameter("todo");
                 if ( (todo != null) && (todo.equalsIgnoreCase("upload")) )
                    Hashtable files = mrequest.getFiles();
                    if ( (files != null) && (!files.isEmpty()) )
                        UploadFile file = (UploadFile) files.get("filename");
                        if (file != null)
                                            out.println("<li>Form field : uploadfile"+"<BR> Uploaded file : "+file.getFileName()+" ("+file.getFileSize()+" bytes)"+"<BR> Content Type : "+file.getContentType());
                                            String fileName=file.getFileName();
                                            String ran=System.currentTimeMillis()+"";
                                            String ext=fileName.substring(   ( fileName.length()-4),fileName.length() );
                                            file.setFileName(ran+ext);
                        // Uses the bean now to store specified by jsp:setProperty at the top.
                        upBean.store(mrequest, "filename");
                                            String title=request.getParameter("title");
                                            String content=request.getParameter("elm1");
                                            int x=dbc.addNews(title,content,file.getFileName(),2,1);
                                            if(x==1)
                                                     out.print("New Vedio has been addedd Successfully");
                                                      response.setHeader("Refresh","1;URL=uploadVedio.jsp");
                                                     else{
                                                      out.print("An Error Occured while adding new Vedio");
                                                      response.setHeader("Refresh","1;URL=uploadVedio.jsp");
                    else
                      out.println("<li>No uploaded files");
             else out.println("<BR> todo="+todo);
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input onClick="submit()" name="addBTN" type="button" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

    the problem is not because of java code insdie jsp page
    I have removed all things but the form and it is still not working
    here is the modified code:
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.print("addBTN");
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input name="addBTN" type="submit" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

  • Bean not found by JSP page

    Hi! All
    I am using a bean in my jsp page. When I open the jsp page, I get an error that "Class SQLBean.DbBean not found". Please help. I have my bean class compiled and saved under C:\tomcat\webapps\examples\WEB-INF\classes
    Here is the bean class:
    package SQLBean;
    import java.sql.*;
    import java.io.*;
    public class DbBean {
    String dbURL = "jdbc:db2:sample";
    String dbDriver = "jdbc:odbc:akhil.mdb";
    private Connection dbCon;
    public Class DbBean(){
    super();
    public boolean connect(String user, String password) throws ClassNotFoundException,SQLException{
    System.out.print("hey");
    Class.forName(dbDriver);
    dbCon = DriverManager.getConnection(dbURL, user, password);
    return true;
    public void close() throws SQLException{
    dbCon.close();
    public ResultSet execSQL(String sql) throws SQLException{
    Statement s = dbCon.createStatement();
    ResultSet r = s.executeQuery(sql);
    return (r == null) ? null : r;
    public int updateSQL(String sql) throws SQLException{
    Statement s = dbCon.createStatement();
    int r = s.executeUpdate(sql);
    return (r == 0) ? 0 : r;
    Here is the jsp page:
    <HTML>
    <HEAD><TITLE>DataBase Search</TITLE></HEAD>
    <BODY>
    <%@ page language="Java" import="java.sql.*" %>
    <jsp:useBean id="db" scope="request" class="SQLBean.DbBean" />
    <jsp:setProperty name="db" property="*" />
    <%!
    ResultSet rs = null ;
    ResultSetMetaData rsmd = null ;
    int numColumns ;
    int i;
    %>
    <center>
    <h2> Results from here</h2>
    <hr>
    <br><br>
    <%
    out.print("Here");
    db.connect("atayal", "arduous");
    try {
    out.print("HI");
    rs = db.execSQL("select * from contacts");
    }catch(SQLException e) {
    throw new ServletException("Your query is not working", e);
    %>
    <%
    while(rs.next()) {
    %>
    <%= rs.getString("email") %>
    <BR>
    <%
    %>
    <BR>
    <%
    db.close();
    %>
    Done
    </body>
    </HTML>
    Thanks in advance

    Thank you for your valuable feedback duffymo. Could
    you explain a little what you mean by "Putting .class
    files in the Tomcat examples directory is a really bad
    idea in the long run". Also, could you direct me to
    some source where I can find more information on
    creating WAR files keeping in mind that I am a
    beginner.
    Thanks.But putting your web apps into WAR files, you can have quite a few different web apps running on the tomcat server as compared to if u place your files into the default webapp folder, u can only have 1 web app running.
    For creating WAR file, the easiest way is to use an IDE like JBuilder.

  • Navigation button not working in JSP

    JDeveloper10g JSP:
    "NestSet", "PreviousSet" button not working after a search is done on a read-only table. Is this a know bug?
    Please help!!!

    Vishal,
    I dont think the Notification Create Button from line item is pretty much dependent on the Customization Settings or any sap note concerning this has not been as yet brought into my notice. In my system, this is working appropriately. The problem with this which i can think of is either an authorization issue or you should raise an oss for this.
    Regards,
    Usman

  • Weblogic 9.1/10 not working on jsp:directive.include file="file.jspf"/

    Does anyone know how to get rid of this problem? I have a jsp page including a sun java studio creator created page fragment using the tag:
    <jsp:directive.include file="myHeader.jspf"/>
    here myHeader.jspf is a page fragment.
    after deployment, weblogic server report error as:
    weblogic.servlet.jsp.CompilationException: Failed to compile JSP /Page1.jsp
    Page1.jsp:15:57: Error in "C:\bea\user_projects\domains\base_domain\servers\AdminServer\tmp\_WL_user\proj\grb4mk\war\myHeader.jspf" at line 1: The encoding "null" specified in the XML prolog is unsupported.
    <jsp:directive.include file="myHeader.jspf"/>
    ^----------------^
    Any idea? I tried both weblogic 9 and 10, same error, change to
    <jsp:include page="myHeader.jspf"/>
    works. the question is: why not read jsp 1.2 tag? Any way to make it work with jsp:directive.include tag?
    thanks in advance.
    Edited by: user10243594 on Sep 10, 2008 10:22 AM

    The "jsp:directive.include" tag is only valid in an well-formed XML file that specifies all the relevant namespaces. The "jsp:include" tag is used in a JSP file. I'll bet the beginning of your file shows that you don't have a valid and well-formed XML file.
    If you found that "jsp:include" worked, then that confirms you have an ordinary JSP file here. Why are you trying to use the XML form? The result of "jsp:include" in a JSP file will be exactly the same as the analogous tag in an XML file.

  • Bean not working in 9i ids

    hello,
    i have a prograss bar bean class and i saved this bean in
    /form90/java and set the property of beans item " implement class" with this bean name but not working or display.
    urgent help.
    thanks

    Syed,
    does it show in the demos ? It's unusual that something doesn't show without an error message. Its hard to guess what the prolem is, but since you don't get Java errors in the Jinitiator panel, the Jar file seems to be there or the Bean conatiner doesn't reference it in his implementation property. However, even if you have a misspelled reference of the Java class in teh implementation class property, the Jinitiator console would show a file not found error. Java Beans are initiated when the canvas that they are placed on shows. This means that setting Bean properties before initialization does not have an effect (as far as I know even this raises an error).
    Which Jintiator version do you have? I am having 1.3.1.13 and experience some problem with the bean demos. It used to work with 1.3.1.9, which is the recommended version. Maybe your problem is similar.
    Fran

  • Servlet filters on Tomcat 6. Not working on JSPs?

    Hi there:
    First of all I want to apologize because I'm not sure if this is the best place to ask a question like this, as it may have more to do with the treatment which Tomcat gives to JSPs more than the servlet filter standard. Anyway, here I go...
    I'm new into the servlet filter's world (well, nor an expert in Java). To start from a point, I decided to try an example from Sing Li, on the IBM website. The code can be watched and downloaded here (the second one): [http://www.ibm.com/developerworks/java/library/j-tomcat/] .
    This filter basically replaces a certain string in the response output (if found) by the dessired one. I've tested this code "as is" (well, changing the package only) and works great for pure servlets. However, testing this with JSPs outputs a simple and plain blank. Doing some research, I've realized that the problem could be in the class which inherits from HttpServletResponseWrapper. Instead of building a new ServletOutputStream I decided to re-utilize exactly the same which comes from the original "request" object but the problem persisted.
    Another user, Giampaolo Tomassoni, faced a similar a problem. A message from him can be found here . He solved this overriding the "flushBuffer ()" method on the class which inherits from HttpServletResponseWrapper. I've tryed to the same, forcing the flush of the ServletOutputStream and the PrintWritter without any luck.
    By the way, I've made sure that filters work on JSPs. Indeed, I've tested others and have done ok. This seems to be related to HttpServletResponseWrapper.
    Do you have any idea about what could be the reason? Many thanks in advance :) .

    I have the same issue.  My 3-month-old Iphone 6 128 GB model (60 GB free) was working fine yesterday.  I did not install any new apps, although typically 5-10 apps update automatically every night.  Today, out of the blue, about 80% of my apps will not load -- the app window opens then immediately crashes to home page (a double press shows the app is still in memory, but when I select it, it pops up for an instant, then goes back to home icon screen.  Example apps (CNN, CBS News, ABC News, NBC News, Scrabble, many others). I tried turning phone off and back on (three times) - no change. Then tried a hard reset (hold power button and home button down simultaneously for 10 seconds) - on reboot still no change.  Then I tried a Restore from backup on my PC - after restarting and clicking through all the welcome to ios 8 screeens - no change; most apps still crash immediately after starting.
    I took my phone to the Verizon store where I bought it.  The agent tried the power off - power on routine again with no success. I informed him that I also tried the restore from backup at home with no success.  He authorized a warranty replacement and my new replacement iPhone will be FEDEXed to my home Tuesday.  Hope this one works after a restore from backup and this isn't some colossal bug with the latest software update (IOS 8.1.3), which I installed about a week ago.  Internet searches reveal that a number of folks are having problems with their 128gb iphone6 devices - something about bad NAND memory.
    Stats on my iPhone 6, in case others have similar problems, so we can possibly identify a trend:  4,831 songs; 1 video, 3,912 photos, 392 applications, 114 gb capacity, 59.8 gb free, version 8.1.3, carrier Verizon 18.1, Model MG602LL/A.
    Has anyone else started having problems with apps suddenly refusing to work on their 128 gb iPhone6?

  • If condition statement not working in jsp scriptlet

    <%
    String hostName = java.net.InetAddress.getLocalHost().getCanonicalHostName();
    if(hostName.endsWith("dinesh.com"))
    System.out.println("it works");
    else {
    System.out.println("it doesn't work");
    %>
    I am getting output as it works & it doesn't work. It seems the If condition is not working. Pls help with this issue.
    Thanks

    Dinesh_Nala wrote:
    Even the condition in if is returning true, the x value i am get as "/user2/"How did you knew that it returns true? Or did you just expect that? Do you trust yourself more than Java? Too bad.
    Just debug it:
    System.out.println("Actual hostname value: [" + hostName + "]");
    System.out.println("Does it end with dinesh.com? " + hostName.endsWith("dinesh.com"));

  • Beginner trying to get my beans to work with jsp on tomcat

    Please help me open my eyes!
    I know this is a stupid oversight on my part, but I've been working for days on getting other things to work on my tomcat server, so I'm out of ideas on this one.
    I've followed all the tomcat docs instructions on where to put my jsp and bean files and set my classpath to where my beans are located. jsps work fine for me but when I try to run this jsp that uses my CalcBean, I get this and similar internal server errors:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 1 in the jsp file: /jsp/calc/calculate.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.0\work\Standalone\localhost\research\jsp\calc\calculate$jsp.java:56: Class org.apache.jsp.CalcBean not found.
    CalcBean calc = null;
    ^
    Do I need to register my bean somewhere like web.xml?
    Thanks so much in advance for any help!!

    rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww

  • Data table not working when jsp is in a subfolder

    In order to organize my jsps I created a few subfolders and placed my new jsps in there. The problem is that when I drag a data table onto the page it does not display correctly. Only the headers show up. Draging a datatable onto a jsp that is not in a subfolder works fine. What gives?

    There are known issues with moving the pages into subfolders as well as renaming subfolders... from release notes:
    Creating a web page in a subfolder causes a page bean to be created in a corresponding sub package in the Java Sources folder. When renaming a subfolder containing web pages, Creator might not properly update the package names of the page beans in the Java Sources directory. In addition, the
    managed-beans.xml file might contain leftover references to the old bean names.
    Workaround
    Use the code editor to change the package names of the Java page beans and delete obsolete
    references to the renamed beans in the managed-beans.xml file.
    http://developers.sun.com/prodtech/javatools/jscreator/community/forums/index.jsp
    This is one area where we know we need to do more testing - so there may be additional gotcha's we haven't identified yet.
    If you create the page initially in the subfolder, is all fine?
    v

  • My first bean not working... is it classpath?

    I am doing my first Javabean ever and it is a very basic one. I have uploaded the bean to a server but it is not running. I am pretty sure that the code is right. My guess is something about classpath but I am not sure. Please read this and let me know if I making a bean in right way???
    1- In the first line in my java file (myBean.java) I write package user;
    2- I put myBean.java in C:\Program Files\Java\jdk1.6.0_11\bin
    3- From the console I run javac myBean.java and get BeanClass.class
    4- I upload myBean.class to the server in directory WEB-INF\classes (I have already asked the web hotel and it should be there)
    5- I run the file and get a org.apache.jasper.JasperException
    Am I compiling in the right place in the right way??? Is it something with the classpath???
    Thanks!!!

    I am going to be straight and to the point with you. I would take a step back and start at the basics again because you seem horribly confused about several things, one of which is the basics of the basics (how to compile java classes).
    You shouldn't even be thinking about web development before you have a firm grasp on Java itself. Have you gone through the introductory tutorial?
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
    That should at least explain to you how to use the tools properly. When you have a little knowledge of how Java ticks and you can write command line programs with it, I would first study how java web applications work. Read about servlets and JSPs and how to deploy a web application properly.

  • Creating a link to text file in a tomcat server not working in JSP webapp

    I am using netbeans to create an web application within my desktop, and then I load the build/web folder to a tomcat server to test the application. Everything works fine. However, when I try to link up my JSP pages to text files (.txt) create by the application on the server, I seem to be getting files that might be kept in a terminal.
    When I get the Real path of the servlet context, I find that it is to a C:\ type file rather than a //hostname type of directory. So obviously those files are not being reached.
    Does anybody know how to deal this problem?

    There are a number of ways to get to the Flash Global Security settings dialog.
    My favourite way is just to double click on a Captivate SWF (not the HTM file) to open it in a web browser, then right click on the playing screen to get the Flash context menu.  On the context menu, click the Global Settings option.
    In the web page that opens, click the link on the left to Global Security Settings.
    Add the folder or drive location of your published Captivate content to the Trusted Locations.

Maybe you are looking for