RE: PDF File Display in JSP-Struts
The question that Abhijeet asked was how to do it in a JSP. I agree that doing this is a kludge. Regards, Jarrod Lugo -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:09 PM To: [EMAIL PROTECTED] Subject: RE: PDF File Display in JSP-Struts Why would you ever do this? This looks like a complete and total kludge. If you are sending back binary data (application/pdf), just do it from the action class using the response.getOutputStream() and return null from the execute method. Advantages: - you already have everything you need right there - you eliminate the entry in struts-config - you eliminate a useless jsp - you can specify any content type (not just one per jsp) - you get better exception handling - the list could go on and on... Larry [EMAIL PROTECTED] 11/12/03 11:43 AM It may be an issue with using white space inside your jsp. I normally do something like this (using a custom fo to pdf bean)... (note: everything up to, and including, the c:set var=junkWhiteSpace is on one line) %@ page contentType=application/pdf %%@ taglib prefix=c uri=http://java.sun.com/jstl/core; %c:import var=blahFo url=/test/blah.fo /c:set var=junkWhiteSpace jsp:useBean id=foToPdf scope=page class=com...FoToPdf / c:set target=${foToPdf} property=inputFo value=${blahFo} / /c:setc:out value=${foToPdf.pdf} escapeXml=false / Regards, Jarrod Lugo -Original Message- From: David Gagnon [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 1:24 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: PDF File Display in JSP-Struts It's not the Internet Explorer problem with pdf ? Check http://xml.apache.org/fop/servlets.html#ie Let me know ... I can give clue on how I solved it. /David -Message d'origine- De : Abhijeet Mahalkar [mailto:[EMAIL PROTECTED] Envoyé : 10 novembre, 2003 07:55 À : Struts Users Mailing List Cc : WebSphere User Group Tech Q A Forum Objet : PDF File Display in JSP-Struts Hi All, I want to display one PDF file in my websphere struts framework. when i do it without struts (only servlets ) it works but when i use JSP along with struts it does not work. it does not read binary data properly... Is there any body to help me out regards thankx in advace... Abhijeet Mahalkar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PDF File Display in JSP-Struts
It may be an issue with using white space inside your jsp. I normally do something like this (using a custom fo to pdf bean)... (note: everything up to, and including, the c:set var=junkWhiteSpace is on one line) %@ page contentType=application/pdf %%@ taglib prefix=c uri=http://java.sun.com/jstl/core; %c:import var=blahFo url=/test/blah.fo /c:set var=junkWhiteSpace jsp:useBean id=foToPdf scope=page class=com...FoToPdf / c:set target=${foToPdf} property=inputFo value=${blahFo} / /c:setc:out value=${foToPdf.pdf} escapeXml=false / Regards, Jarrod Lugo -Original Message- From: David Gagnon [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 1:24 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: PDF File Display in JSP-Struts It's not the Internet Explorer problem with pdf ? Check http://xml.apache.org/fop/servlets.html#ie Let me know ... I can give clue on how I solved it. /David -Message d'origine- De : Abhijeet Mahalkar [mailto:[EMAIL PROTECTED] Envoyé : 10 novembre, 2003 07:55 À : Struts Users Mailing List Cc : WebSphere User Group Tech Q A Forum Objet : PDF File Display in JSP-Struts Hi All, I want to display one PDF file in my websphere struts framework. when i do it without struts (only servlets ) it works but when i use JSP along with struts it does not work. it does not read binary data properly... Is there any body to help me out regards thankx in advace... Abhijeet Mahalkar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts custom tags tutorial
Using some style sheet logic in conjunction with JSTL is an elegant solution. Here's a quick snip of code to do just that (the arraylist should come from the action, and the style sheet should be in it's own file, but you get the idea). *snip* style type=text/css !-- .negative_true { color: #ff; } .negative_false { color: #00; } -- /style % String dataValues[] = {500, -200, 100, 20, 5, -7, 0, 800}; pageContext.setAttribute(dataValues, dataValues); % table cellpadding=4 cellspacing=0 border=1 tr tdstrongValues/strong/td /tr c:forEach var=dataValue items=${dataValues} tr %-- This next line is really the only logic that needs included for negative value checking. My personal opinion is that this code has a small footprint, and I wouldn't mind having this presentation logic duplicated in multiple places throughout my app. --% td class=negative_c:out value=${dataValue 0} /c:out value=${dataValue} //td /tr /c:forEach /table /*snip* Have fun. Regards, Jarrod Lugo -Original Message- From: Edgar Dollin [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 5:14 PM To: 'Struts Users Mailing List' Subject: RE: Struts custom tags tutorial In the case, the user described below, I didn't. What he wanted to do was, based on data values, guarantee a color scheme and other criteria, i.e. maybe all negative numbers should be in red. This is view based logic, but one of the priciples we all use is try not to write the same code twice. I might be missing something but, JSTL, and most view technologies (except custom tags, source includes and tiles), don't have the ability to modularize common code or have strange syntax to achieve the modularization. So to say just use the standard technologies and let the view have the view logic is a bit of a cop out. I suspect that most of what he wants to do is already in struts-layout so there is a work around without writing his own tags. Edgar -Original Message- From: Bill Chmura [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 12:53 PM To: 'Struts Users Mailing List' Subject: RE: Struts custom tags tutorial I am not sure if you agreed with me or not on that one. In case you did not, to clarify: I think that the view should handle all the logic for presenting the data. It should not be tied into the business logic For example, the business logic should know how to get all the parts from the database that are active. The View logic should cover how to make them into rows, colors, highlighting. The display should really only know what data is coming back. From then on it should have the responsibility of making it pretty and paginating and such. I think we may be on the same page -Original Message- From: Edgar Dollin [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 10:07 AM To: 'Struts Users Mailing List' Subject: RE: Struts custom tags tutorial Logic in the display which needs to know anything about the specifics of business logic, makes no sense to me, although there seem to be very few of us who have this attitude. Examples of this include field size; required fields; number logic (internationalization), etc. Edgar -Original Message- From: Bill Chmura [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 4:26 AM To: 'Struts Users Mailing List' Subject: RE: Struts custom tags tutorial Here are two easy ways out... http://edhill.its.uiowa.edu/display-examples/ (Wonderful, worked great for me) or http://jakarta.apache.org/velocity (Simple templating, integrates nicely) my code corresponding to these struts tags else where. This way the logic to display the data will not be there on the JSP page. Why don't you want the display logic there? I always considered that the view should control how the data is displayed... I could (and often are wrong about these things) but it strikes me as strange. If you are trying to keep it simple for HTML developers, try velocity. Most anyone can do templates in that. Me -Original Message- From: Seshadhri Srinivasan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 2:51 AM To: 'Struts Users Mailing List' Subject: RE: Struts custom tags tutorial Hi Steve, Let me clarify: I know some of the basic concepts of struts and I have been using things like the Action class, the Form class etc. But the point is, after having finished the work on the backend logic, I have to present my data in the form of tables on the page. Now the table dimensions, the colours used, etc. can vary based on the data
Problems with Struts 1.1, html-el, and weblogic 6.1
I have been running Struts 1.1 on WebLogic 6.1 with no problems (using both the html and html-el taglibs), until I tried to use the precompile option. If I have a page that uses the html taglib, the compilation works fine. But if I change the page to use the html-el taglib, I get this error. Any help would be greatly appreciated. Regards, Jarrod Lugo [ERROR] MessageResourcesFactory - -MessageResourcesFactory.createFactory java.lang.ClassNotFoundException: org.apache.struts.util.PropertyMessageResourcesFactoryjava.lang.ClassNotFou ndException: org.apache.struts.util.PropertyMessageResourcesFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:183) at java.lang.ClassLoader.loadClass(ClassLoader.java:294) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281) at java.lang.ClassLoader.loadClass(ClassLoader.java:250) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207) at org.apache.struts.util.MessageResourcesFactory.createFactory(MessageResource sFactory.java:192) at org.apache.struts.util.MessageResources.getMessageResources(MessageResources .java:576) at org.apache.struts.util.RequestUtils.clinit(RequestUtils.java:134) at org.apache.struts.util.MessageResourcesFactory.createFactory(MessageResource sFactory.java:192) at org.apache.struts.util.MessageResources.getMessageResources(MessageResources .java:576) at org.apache.struts.taglib.html.BaseTag.clinit(BaseTag.java:94) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:115) at org.apache.strutsel.taglib.html.ELBaseTagBeanInfo.class$(ELBaseTagBeanInfo.j ava:81) at org.apache.strutsel.taglib.html.ELBaseTagBeanInfo.getPropertyDescriptors(ELB aseTagBeanInfo.java:81) at java.beans.Introspector.getTargetPropertyInfo(Introspector.java:341) at java.beans.Introspector.getBeanInfo(Introspector.java:291) at java.beans.Introspector.getBeanInfo(Introspector.java:123) at weblogic.servlet.jsp.StandardTagLib.parseTagDD(StandardTagLib.java:1034) at weblogic.servlet.jsp.StandardTagLib.parseDD(StandardTagLib.java:972) at weblogic.servlet.jsp.StandardTagLib.init(StandardTagLib.java:207) at weblogic.servlet.jsp.JspLexer.loadTagLib(JspLexer.java:150) at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:4596) at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:4434) at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:4281) at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:2167) at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1978) at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1860) at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:1100) at weblogic.servlet.jsp.JspParser.doit(JspParser.java:89) at weblogic.servlet.jsp.JspParser.parse(JspParser.java:192) at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:119) at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:255) at weblogic.servlet.jsp.Precompiler.compileOne(Precompiler.java:153) at weblogic.servlet.jsp.Precompiler.compile(Precompiler.java:54) at weblogic.servlet.internal.WebAppServletContext.precompileJSPs(WebAppServletC ontext.java:3439) at weblogic.servlet.internal.WebAppServletContext.precompileJSPs(WebAppServletC ontext.java:3432) at weblogic.servlet.internal.WebAppServletContext.initFromDescriptors(WebAppSer vletContext.java:1669) at weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.jav a:888) at weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.j ava:823) at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:444) at weblogic.j2ee.WebAppComponent.deploy(WebAppComponent.java:78) at weblogic.j2ee.Application.addComponent(Application.java:170) at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117) at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentT arget.java:360) at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentT arget.java:150) at weblogic.management.mbeans.custom.WebServer.addWebDeployment(WebServer.java: 76) at java.lang.reflect.Method.invoke(Native Method) at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl .java:636) at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:6 21) at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBea nImpl.java:360) at
RE: Newbie Question about tiles definitions. I am lost :(
I changed the action mapping, but I don't think I have an action servlet. How do I map *.do to the action servlet? Thanks, Jarrod Lugo -Original Message- From: John Espey [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 3:56 PM To: Struts Users Mailing List Subject: RE: Newbie Question about tiles definitions. I am lost :( If you have *.do mapped to the action servlet, then you will need to request (relative to the webapp of course) /home.do or /products.do. You'll need to switch the action mapping like so: action path=/home forward=tiles.home Or else configure the mapping such that an action that automatically forwards to success (I think ForwardAction does the trick) is specified. I haven't tried using the . as the first character in the tile name, but it may work. I changed it in the above snippet just in case. -Original Message- From: Jarrod M. Lugo [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 2:14 PM To: Struts-User@Jakarta. Apache. Org Subject: Newbie Question about tiles definitions. I am lost :( Hello, I am trying to get tiles to work with definitions, and I am having a little trouble. How do I get either the home page or products page to show up in my browser? struts-config.xml: action path=/home forward name=success path=.home / /action action path=/products forward name=success path=.products / /action tiles-def.xml: definition name=.home path=/basicLayout.jsp put name=title value=Home / /definition definition name=.products path=/basicLayout.jsp put name=title value=Products / /definition basicLayout.jsp: html body tiles:getAsString name=title / /body /html TIA, Jarrod Lugo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie Question about tiles definitions. I am lost :(
Hello, I am trying to get tiles to work with definitions, and I am having a little trouble. How do I get either the home page or products page to show up in my browser? struts-config.xml: action path=/home forward name=success path=.home / /action action path=/products forward name=success path=.products / /action tiles-def.xml: definition name=.home path=/basicLayout.jsp put name=title value=Home / /definition definition name=.products path=/basicLayout.jsp put name=title value=Products / /definition basicLayout.jsp: html body tiles:getAsString name=title / /body /html TIA, Jarrod Lugo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Difference between Tiles and Templates ?
I have tried replacing template:* with tiles:*, and some of my apps do not work properly. I am at a loss as to how to nest tiles tags, because I used to do it with templates, but I can't with tiles... I posted messages before about this issue, but didn't get any responses. Any help would be greatly appreciated. (I can post the code if needed) Regards, Jarrod Lugo -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 11:02 AM To: [EMAIL PROTECTED] Subject: RE: Difference between Tiles and Templates ? Is there any difference between teh template tags and the Tiles tag libraries? The template taglib is deprecated in 1.1 in favor of Tiles. You should be able to use Tiles like templates by replacing template:* with tiles:* in your JSPs. Cheers, Naggi David _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Nesting a tiles:insert inside of a tiles:put is returning Illegal to flush within a custom tag
Hello, I have a situation that I need to nest a tiles:insert inside of a tiles:put. I did this with template tags in the past with no problem. I am now getting an Illegal to flush within a custom tag error when I changed all the template tags to tiles. I have read about similar problems when nesting a tiles tag inside of an iteration tag... So, I hacked it by using tiles for the outer insert/puts, and a template for the inner insert/puts, but I shouldn't have to do this, right? Plus, I may need to use tiles for the inner insert/puts in the future and it is just ugly to mix and match this stuff... Any help would greatly be appreciated. If you need it, I have a small chunk of code exemplifying what I am trying to do. Thanks for your help, Jarrod Lugo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]