Re: JSTLExamples NetBean Sample Project
Hi Tim/Stani, I'd go so far as to say SQL doesn't even belong in the model layer as per Fowler/Larmen/whomever 3-layer approaches. My recommendation is to use some form of Controller servlet that takes care of much of what is needed, like setting up connections and setting attributes (not directly, see Fowler's P of EAA or my thesis --if you're a masochist-- https://soenea.htmlweb.com/trac/browser/Documentation/trunk/Thesis/Thesis_Stuart.pdf). This allows problems like that to be addressed in the appropriate places, leaving the JSP Templates oblivious to it all and letting the jstl stuff stick to providing appropriate support to display relevant data in the JSPs. Even if your abstraction was less religiously (Domain) Object-Oriented than what I propose, having your jstl stuff just manipulate some form of ResultSet/DAO would probably achieve appropriate separation, with problems like missing database drivers happening before the JSP is even dispatched to (and possibly leading to the dispatching to an error view). Stuart On 10/27/2011 11:21 AM, Stani Ryabenkiy wrote: Hi Tim, 1) using SQL tags in a JSP is a bad design choice, I recommend against it. SQL belongs in the model layer, not the presentation layer. 2) I am not familiar with how NetBeans does things nor have I tried Derby but to me this sounds like a typical Tomcat class loader problem. The SQL tags (or whatever is looking for the Derby driver) are outside your application (loaded by Tomcat's common class loader) so they cannot see the Derby classes loaded inside your application. Try locating the Tomcat installation that NetBeans is starting and add the Derby driver jar to the lib folder in there, that will most likely fix it. Good Luck, Stani On Thu, Oct 27, 2011 at 11:14 AM, Tim Puchalatim.puch...@hotmail.comwrote: I’m trying to run explore SQL Tags section of the sample project provided by NetBeans called JSTLExamples I changed the database url to use sample rather than the default jstl-sample because that is the databes in the Services pane under Databases. The schema is APP and the user is app. I used app and app for user and password. I am getting an SQLException when executing the QueryIterate option (first on the page). The description of the exception is “No suitable driver found for jdbc:derby://localhost:1527/sample;create=true I have tried adding the jar file derbyclient.jar to the project library, but this doesn’t correct the error. I would have thought the project shouldn’t need tweaking like this anyway if it’s a sample project provided by Netbeans. Any ideas, anybody? - To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
Re: How to use index in EL expression?
Hello Kazuaki, Very sorry for the response. I'm teaching this material right now and assumed this was a student request (I have 70 of them) and only now noticed that this was on the taglibs mailing list. Again, so sorry. The advice in the prior is still sound, but now very out fo context. The reasoning is still good. I really think something in your domain layer should be parsing your params and cleanly taking care of this all. You can still provide the cleaned up POJOS via attributes, and that makes more sense. If you're entirely skipping regular servlets and allowing direct access to JSP you can probably use something like ${paramValues.key[i]} On Wed, Sep 24, 2014 at 5:54 AM, Kazuaki Miyauchi miyau...@gmail.com wrote: Hi, it is also convenient to use the iteration of ELs such as c:if test=${!empty param.t${i}vorname}. Of course, it doesn't work. But, I'd like to do the following iteration. c:forEach var=i begin=1 end=8 sql:update var=insert${i} insert into member values (1,?::integer,${i},?,?,?) sql:param value='${param.department}' / sql:param value='${teamid}' / sql:param value=${param.t${i}vorname} / sql:param value=${param.t${i}name} / /sql:update /c:forEach Is there some idea for this without whole description expanding i? Regards, - To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org -- Stuart Thiel, P. Eng. - To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
Re: How to convert String to Date in EL?
That's what parseDate does, and why I pointed you at it. On Tue, Aug 20, 2019, 04:15 Kazuaki Miyauchi wrote: > This also works using Java description as following. > > > <% SimpleDateFormat sdFormat = new SimpleDateFormat("/MM/dd"); >Date date = sdFormat.parse(session.getAttribute("date").toString()); >session.setAttribute("date_o", date); %> > > > insert into test values(?,?) > > > > > We need such complicated way to Web-DB access? > We need simple way using EL description. > > Regards,Kazuaki Miyauchi, Japan > > - > To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org > For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org > >
Re: How to cast String to int in EL?
Ah, it is parameter casting you're after. That was unclear from your initial request. What does: yield? On Tue, Aug 20, 2019, 02:07 Kazuaki Miyauchi wrote: > Hi, Stuart > > 2019-08-19 20:32 GMT+09:00, Stuart Thiel : > > I can't speak to Tomcat 5, that's been years. However, the code you're > > using is not passing an integer. If you take a look at the generated > > Java source (which is a mess with taglibs) you may see why. Once more, > > a quick google suggests some solutions, in particular, the trivial > > one: > > Following source works correctly, of course. > > > <% int member_id = (int)session.getAttribute("member_id"); >session.setAttribute("member_id_num", member_id); %> > > > insert into test values(?,?) > > > > > Ordinary we get HTTP request parameter via EL using ${param.hogehoge}. > So, It's troublesome to write following. > int member_id = Integer.valueOf(request.getAttribute("member_id"); > session.setAttribute("member_id_num", member_id); > > Instead of > > Isn't there more convenient way? > > Regards, Kazuaki Miyauchi, Japan > > - > To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org > For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org > >
Re: How to convert String to Date in EL?
Because formats for dates are so ambiguous, there's no reliable way to interpret. The is why you'd use the parseDate tag, probably inside a set to get a date object that you'd then pass to your dateparam thing. Presumably you could write an el "function" to do that inline if you wanted to out in the effort to clean your JSP further, as I don't know of such thing existing (though I can't imagine why it shouldn't, save to discourage everyone putting all their application logic and validation in JSPs) On Tue, Aug 20, 2019, 05:22 Kazuaki Miyauchi wrote: > 2019-08-20 16:39 GMT+09:00, Stuart Thiel : > > That's what parseDate does, and why I pointed you at it. > > I also want to do like int case as following. > > > > > > > > insert into test values(?,?) > > > > > But, of course, this makes > > javax.el.ELException: Cannot convert [2019-8-20] of type [class > java.lang.String] to [class java.util.Date] > > So, I'd like to know how to convert Date type using EL writing. > Is there simple method to convert like 0 + for int case? > > Regards,Kazuaki Miyauchi, Japan > > - > To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org > For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org > >
Re: How to cast String to int in EL?
Just be careful. If there is no paean passed, I expect it silently evaluates to 0. On Tue, Aug 20, 2019, 05:09 Kazuaki Miyauchi wrote: > Thank you, Stuart! This is what I want to know. > > 2019-08-20 16:48 GMT+09:00, Stuart Thiel : > > Ah, it is parameter casting you're after. That was unclear from your > > initial request. What does: > > > > yield? > > Following correctly works!! > > > > > insert into test values(?,?) > > > > > Regards, Kazuaki Miyauchi, Japan > > - > To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org > For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org > >
Re: How to convert String to Date in EL?
I suspect you can skip the set tag and wrap the parseDate in the sqlParam tag as well, but I've never mucked with sql in JSPs (I'm pretty strict about using them exclusively as Template Views) On Tue, Aug 20, 2019, 05:44 Stuart Thiel wrote: > Because formats for dates are so ambiguous, there's no reliable way to > interpret. The is why you'd use the parseDate tag, probably inside a set to > get a date object that you'd then pass to your dateparam thing. Presumably > you could write an el "function" to do that inline if you wanted to out in > the effort to clean your JSP further, as I don't know of such thing > existing (though I can't imagine why it shouldn't, save to discourage > everyone putting all their application logic and validation in JSPs) > > On Tue, Aug 20, 2019, 05:22 Kazuaki Miyauchi wrote: > >> 2019-08-20 16:39 GMT+09:00, Stuart Thiel : >> > That's what parseDate does, and why I pointed you at it. >> >> I also want to do like int case as following. >> >> >> >> >> >> >> >> insert into test values(?,?) >> >> >> >> >> But, of course, this makes >> >> javax.el.ELException: Cannot convert [2019-8-20] of type [class >> java.lang.String] to [class java.util.Date] >> >> So, I'd like to know how to convert Date type using EL writing. >> Is there simple method to convert like 0 + for int case? >> >> Regards,Kazuaki Miyauchi, Japan >> >> - >> To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org >> >>
Re: How to convert String to Date in EL?
Nope, its to convert a string to a date. I think BalusC is the answer (ranked 246 or something). While the initial question was not what you were looking for, the reason I suggested you have a read is because you can often learn a lot of other things (in particular what you are looking for), and I'm suspecting you didn't take that advice here. On Mon, Aug 19, 2019, 01:30 Kazuaki Miyauchi wrote: > Hi, Stuart, Thanks for your quick reply. > > 2019年8月19日(月) 13:01 Stuart Thiel : > > The solution with fmt:parseDate is likely what you want, but read what > > they say and perhaps change what you're doing a bit. > > That is to convert Date type to String. > I'd like to know reverse way. Google doesn't hit this error message. > > Regards,Kazuaki Miyauchi, Japan > > - > To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org > For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org > >
Re: javax.servlet.jsp.JspException: IO Error: Stream closed
Hello, It sounds like you're probably used a forward to get to one of the things instead of an include. When the forward is done, the stream is closed. JBoss may not have enforced that, but in my experience Tomcat does (as it should). Alternatively, you have something that's explicitly closing the writer, but that would likely have caused a problem for JBoss as well. On Tue, Jan 21, 2020 at 11:51 AM Enzo M. wrote: > > We have a legacy application based on JSP pages that use Custom Tags. The > custom tags extends javax.servlet.jsp.tagext.BodyTagSupport > > This application worked fine for years on JBoss, but now we migrated to > Tomcat and the same code throws the following exception: > > "javax.servlet.jsp.JspException: IO Error: Stream closed" > > on Repetition.doEndTag() line marked below: > > public int doEndTag() throws JspException { > > try { > if (bodyContent != null) { > /* Stream Closed here => */ > bodyContent.writeOut(bodyContent.getEnclosingWriter()); > bodyContent.clearBody(); > } > } > catch (IOException e) { > throw new JspException("IO Error: " + e.getLocalizedMessage()); > } > finally { > cleanup(); > } > > return EVAL_PAGE; > > } > > Any ideas? We tried different versions of Tomcat (8.5.24, 8.5.47, 9.0.27) > as well as different versions of jsp-api.jar and servlet-api.jar but the > problem still there. > > Thanks -- Stuart Thiel, P. Eng. - To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
Re: Apache Tomcat Version 9.0.65
Hi folks, I didn't know this list was still alive, and I don't work for Apache (and this isn't so much a support mailing list, so you won't get whom you addressed stuff to), but it looks like it's a SOAP error, so not Tomcat so much as whatever ancient web-services interface you've set up. Tomcat's just dutifully passing up the error, I imagine. The error's you can conveniently replace with tomcat are the server-level error-code ones (like 404), but this is a different beast, so it's a red herring to look there. Whomever set this up would likely know where the SOAP interface began and should know who to either catch/wrap things coming out sensibly, or manually adjust the errors. The specific error looks like the "closing" end of an XML comment being found some place it doesn't belong, so presumably, this is just a parse error inside the SOAP thing you're using. On Wed, Aug 24, 2022 at 6:12 AM MOHD AMIR FAIZ wrote: > > Hi Tomcat Support, > > Based on our current setup, Apache Tomcat Version 9.0.65 is installed on top > of Windows Operating System. The server is basically dedicated for an > API-based Program where there is an integration process occur between our API > & client’s Application. > > We had gone through a Penetration Test activity recently and there is 1 test > case that we encounter related to error handling in Tomcat. What the > pen-tester do is they purposely insert the wrong formatting input validation > just to see the response received on Client’s Application level. However, the > input not even submitted to Application level since it has been > removed/eliminated automatically by the Tomcat and generate some technical > error message. According to the pen-tester team, that error message should be > customize to non-technical message to avoid any exploitation activity occur. > We had tried to find solution for that in Tomcat, however we can’t implement > as they requested. > > Hence, we would like to get clarification from Tomcat Team, is there any ways > that the error message can be customize in Tomcat? And is there any potential > risk that Application might have when this kind of error message is being > exposed? Sample of the Tomcat error message response as below: > > > http://schemas.xmlsoap.org/soap/envelope.> > > http://www.w3.org/2003/05/soap-envelope> > S:Server > javax.xml.bind.UnmarchalException > -with linked exception: > [com.ctc.wstx.exc.WstcParsingException: String ‘]]’ not allowed in > textual content, except as the end marshalexception at [row,col > {unknown-source}]: [8,26]] > > > > > > > > Thanks and have a good day, > > Amir > > Project Manager > Project Management Office > > > MSC Trustgate.com Sdn. Bhd. (478231-x) > Suite 2-9,Level 2, Block 4801 > CBD Perdana, Jalan Perdana > 63000 Cyberjaya > Selangor Darul Ehsan > Malaysia > Tel: +603 8318 1800 > Fax: +603 8319 1800 > HP: +6017 3913905 > a...@msctrustgate.com > -- Dr. Stuart Thiel, P. Eng. - To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org