doesn't get rendered
Hi All, Maybe someone has done this before : I am trying to use to deliver a in my JSP, however, the tag doesn't get rendered when it is delivered. Instead, the raw tag, , is delivered. Am I missing anything here? Any suggestions please. Thank you. Bob. A snippet from my ApplicationResources.properties file : . . books.publisher.heading= . . A snippet from my JSP : . . . .
[repost][OT]I can no longer start TC from W2k from the
Hi All, I can no longer start TC from W2k from the Start >> Program >> Apache Tomcat 4.1 >> Start Tomcat using the parameters E:\j2sdk1.4.1_01\bin\java.exe -jar -Duser.dir="E:\Tomcat 4.1" "E:\Tomcat 4.1\bin\bootstrap.jar" start Tomcat start by opening a commandline window as usual, but this window vanishes after displaying the ff. on the screen : 04.07.2003 17:12:57 org.apache.commons.modeler.Registry loadRegistry INFO: Loading registry information 04.07.2003 17:12:57 org.apache.commons.modeler.Registry getRegistry INFO: Creating new Registry instance 04.07.2003 17:12:58 org.apache.commons.modeler.Registry getServer INFO: Creating MBeanServer 04.07.2003 17:12:59 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 8080 04.07.2003 17:12:59 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 80 Starting service Tomcat-Standalone Apache Tomcat/4.1.18-LE-jdk14 I am using struts and running 2 on TC : one on port 8080 and the other on port 80. What could be the root course. I have looked into the logs folder, but I can find any log info. to show me what is missing. Tomcat starts both with no problem when I do start it in my ide. Any help will be much appreciated. Thanks. Bob.
[OT]I can no longer start TC from W2k from the
Hi All, I can no longer start TC from W2k from the Start >> Program >> Apache Tomcat 4.1 >> Start Tomcat using the parameters E:\j2sdk1.4.1_01\bin\java.exe -jar -Duser.dir="E:\Tomcat 4.1" "E:\Tomcat 4.1\bin\bootstrap.jar" start Tomcat start by opening a commandline window as usual, but this window vanishes after displaying the ff. on the screen : 04.07.2003 17:12:57 org.apache.commons.modeler.Registry loadRegistry INFO: Loading registry information 04.07.2003 17:12:57 org.apache.commons.modeler.Registry getRegistry INFO: Creating new Registry instance 04.07.2003 17:12:58 org.apache.commons.modeler.Registry getServer INFO: Creating MBeanServer 04.07.2003 17:12:59 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 8080 04.07.2003 17:12:59 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 80 Starting service Tomcat-Standalone Apache Tomcat/4.1.18-LE-jdk14 I am using struts and running 2 on TC : one on port 8080 and the other on port 80. What could be the root course. I have looked into the logs folder, but I can find any log info. to show me what is missing. Tomcat starts both with no problem when I do start it in my ide. Any help will be much appreciated. Thanks. Bob.
Re: character entities conversion
The output rendered perfectly when the filter attrib. was set to 'false'! Thanks once again James. Bob.
Re: character entities conversion
Hi James, Thanks for the link to the docs. I got the ff. from the docs a short while ago : "filter If this attribute is set to true, the rendered property value will be filtered for characters that are sensitive in HTML, and any such characters will be replaced by their entity equivalents." I have set the filter attrib. to 'true' , however, my output is still the same. I do still get: "...you use UNIX, you probably use csh to type commands even if you've never heard of it. It's the standard shell (command line) on most UNIX systems..." instead of : "you use UNIX, you probably use csh to type commands even if you've never heard of it. It's the standard shell (command line) on most UNIX systems" What could be missing here?
Re: character entities conversion
Hi James, I would very much like to. Please direct me to where I can get the needed info. in the docs. I have never had to use the filter attrib. in a tag. Any suggestions are welcome.
Re: character entities conversion
I am using the tag. Are suggesting that I write something like : ?
Re: Best practices - help
Thank you all for your useful suggestions. I have gotten it up working now with only something left which I wish it were not there: I have this '../myaction.do' trailling at the end of the URL which I wish it were not there. Preferable would have been /myaction.do after being called in the < global-forwards> to call my action servlet, will re-direct or forward to /MyLayer.jsp. I know that it can be done , but I don't where/how to fix that in my struts-config.xml file. Any ideas ? Thanks. Bob
character entities conversion
Has anyone any idea how to get character entities which are delivered to a Java Bean from a database converted or rendered to its normal characters in a JSP layer? E.g.. I have a database which is delivering "&","'" etc. instead of the characters "&", "'" etc. in my JSP presentation layer. I have set <%@ page contentType="text/html;charset=UTF-8" language="java"%> in my JSPs but to no-avail. I am getting an output such as : "...you use UNIX, you probably use csh to type commands even if you've never heard of it. It's the standard shell (command line) on most UNIX systems..." instead of : "you use UNIX, you probably use csh to type commands even if you've never heard of it. It's the standard shell (command line) on most UNIX systems" Thanks. Bob
Re: Best practices - help
Hi Steve, The problem is that /MyLayer.jsp happens to be my welcome page. This page has to be displayed on start up.How do I get struts process my Action servlet,myAction, in order to give /MyLayer.jsp the content it needs? Thanks
Re: [OT] Mark Webcam
Maybe providing a : 1. Username and 2. A password would be helpful. Or ?
Re: How do I configure multiple struts-config files?
check : http://jakarta.apache.org/struts/userGuide/configuration.html#dd_config_module s HTH
Best practices - help
Is there a way to populate a bean on a Server's (I'm using Tomcat) start up in Struts? I have a Java bean, say X, which is called and a populated in an Action Servlet, say myAction. Whenever I start my application and call a JSP layer say, MyLayer.jsp, which is supposed to iterate this bean using , I get the exception: org.apache.jasper.JasperException: Cannot find bean X in scope session - - However, this exception disappears when I first call the Action Servlet directly with a call such as http://localhost/myaction.do , followed by a http://localhost/MyLayer.jsp call. Apparently the bean has nothing to show when I first call MyLayer.jsp. Can someone suggest a better approach? Thanks Bob Ps.: the bean, X, get its values from a database. my struts-config.xml snippet : --- -- --- ---
ResultSet get closed before connection closes - Help!
I am using a GenericDatasource to establish a connection to a mysql database. The connection get established all right, but when I try to walk the ResultSet, I do get an SQLException which interprets as the ResultSet having been closed. Can someone please explain why a ResultSet object cannot be iterated or walked through even before I close the connection to the database? Exception(java.sql.SQLException: Operation not allowed after ResultSet closed) occurs when I try to call the method next() of java.sql.ResultSet A snippet of the code in my Action class read as follows: private ResultSet myResultSet; -- --- HttpSession session = request.getSession(); try { dataSource = getDataSource(request); myConnection = dataSource.getConnection(); Statement stmt = myConnection.createStatement(); myResultSet = stmt.executeQuery("SELECT * FROM my_table ORDER BY id ;"); this.setResultSet(myResultSet); } catch (SQLException sqle) { } ArrayList bookArrayList = new ArrayList(); try { ResultSet res = this.getResultSet(); while (res.next()) { Book book = new Book(); book.setEnglishISBN(res.getString("isbn")); book.setEnglishAUTHOR(res.getString("author")); bookArrayList.add(book); } } catch (SQLException ignored) { } session.setAttribute("Books", bookArrayList); if (myConnection != null) { try { myConnection.close(); } catch (SQLException e) { } } return (mapping.findForward("ignoredPage")); } public void setResultSet(ResultSet res) { this.myResultSet = res; } public ResultSet getResultSet() { return this.myResultSet; }
Re: can't find bean using logic:iterator
Have tried that too, I get the same exception.
Re: can't find bean using logic:iterator
Hi Rich, These are the changes I have made so far : Books.jsp : BookAction : ArrayList newArrayList = new ArrayList(); ResultSet res = this.getResultSet(); while (res.next()) { Book conn = new Book(); conn.setEnglishISBN(res.getString("isbn")); conn.setEnglishAUTHOR(res.getString("author")); newArrayList.add(conn); } request.setAttribute("Book", newArrayList); return (mapping.findForward("techbooks")); And I still get a 500 HTTP Status exception : org.apache.jasper.JasperException: Cannot find bean newArrayList in scope request at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) --- --- root cause javax.servlet.ServletException: Cannot find bean newArrayList in scope request at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:530) at org.apache.jsp.Books_jsp._jspService(Books_jsp.java:427) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
Re: can't find bean using logic:iterator
Hi daniel, I am still getting a HTTP Status 500 - Cannot find bean Book in scope session . - as before even if I try to iterate this bean in a session scope
can't find bean using logic:iterator
Hi to Everyone, I am trying to use the tag in my JSP to iterate an ArrayList object which is supposed to be delivered by a bean, called Book, and I do repeatedly get the following exception : [ org.apache.jasper.JasperException: Cannot find bean Book in any scope at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFi lterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) root cause javax.servlet.ServletException: Cannot find bean Books in any scope at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:530) at org.apache.jsp.Books_jsp._jspService(Books_jsp.java:407) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) --- --- ] Here is a snippet from my Action class, BookAction : -- ArrayList newArrayList = new ArrayList(); Book conn = new Book(); ResultSet res = this.getResultSet(); while (res.next()) { newArrayList = new ArrayList(); conn.setEnglishISBN(res.getString("isbn")); conn.setEnglishAUTHOR(res.getString("author")); newArrayList.add(conn); } request.setAttribute("Book", newArrayList); return (mapping.findForward("techbooks")); } struts-config.xml: -- -- Books.jsp: - - - Where could I be going wrong ? Any help/suggestions will be much appreciated. Bob
Re: NewBie Q: can't find bean
I don't how to incorporate your suggestion in the ff.: logic:iterate tag :
Re: NewBie Q: can't find bean
I have commented out the following "if" statement too in my Action class : if (action == null) { return (mapping.findForward("techbooks")); } But I still get : org.apache.jasper.JasperException: Cannot find bean Books in scope request at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) --- --- root cause javax.servlet.ServletException: Cannot find bean Books in scope request at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:530) at org.apache.jsp.Books_jsp._jspService(Books_jsp.java:413) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Re: NewBie Q: can't find bean
That's also corrected, but the exception still appears!
Re: NewBie Q: can't find bean
Hi Marc, I have re-written my code to follow your example, using Arraylists, but I still get the following exception : org.apache.jasper.JasperException: Cannot find bean Books in scope request at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) root cause javax.servlet.ServletException: Cannot find bean Books in scope request at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:530) at org.apache.jsp.tfp_techbooks_jsp._jspService(Books_jsp.java:413) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
Re: NewBie Q: can't find bean
After inserting the scope attrib. to be request, I do still get the following exception : org.apache.jasper.JasperException: Cannot find bean Books in scope request at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) My JSp once again :
Re: NewBie Q: can't find bean
In my jsp, I have used the iterate tag as follows : I don't understand what you mean by "Are you looking in the correct scope with the iterate tag?"
NewBie Q: can't find bean
Hi to Everyone, I am trying to use the tag in my JSP to iterate a vector object which is supposed to be delivered by a bean, called Books, and I do repeatedly get the following exception : [ org.apache.jasper.JasperException: Cannot find bean Books in any scope at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) root cause javax.servlet.ServletException: Cannot find bean Books in any scope at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:530) at org.apache.jsp.tfp_techbooks_jsp._jspService(Books_jsp.java:407) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) --- --- ] Here is a snippet from my Action class, BookAction : -- if (action == null) { return (mapping.findForward("techbooks")); } newVector = new Vector(newConnClass.getISBN()); this.setISBN(newVector); request.setAttribute("Books", newVector); return (mapping.findForward("techbooks")); } struts-config.xml: -- -- Books.jsp: - - - Where could I be going wrong ? Any help/suggestions will be much appreciated. Bob
Re: Newbie Q: Cannot load JDBC driver class using Datasource Connection
Thanks Brandon , Dimitar, Mark It's working now : After putting the JDBC driver jar in $TOMCAT_HOME/common/lib and referencing it in Tomcat's classpath, it's working!
Re: Newbie Q: Cannot load JDBC driver class using Datasource Connection
Yes, I have my JDBC driver both in my application's as well as in Tomcat's classpaths
Newbie Q: Cannot load JDBC driver class using Datasource Connection
Am I missing something here? Tomcat keeps on giving me the following exception about my JDBC connection driver not being loaded when I try to establish a datasource connection to a mysql database in struts : Initializing application data source org.apache.struts.action.DATA_SOURCE java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529) at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:381) at org.apache.struts.action.ActionServlet.initApplicationDataSources(ActionServlet.java:942) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:457) at javax.servlet.GenericServlet.init(GenericServlet.java:256) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc essorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) My struts-config.xml looks like this : Info: This driver , com.mysql.jdbc.Driver, does establish connection to this same database with no exception when I use it in a normal java class. Can someone tell me or atleast point me to where I can find further help/information. I could not find anything at http://jakarta.apache.org/struts/faqs/database.html and also in this list's archives. Thanks, robert