EL expressions with c:out tags?

Hi,
If EL expressions are normally evaluated and displayed on a page, what is the purpose of enclosing them in <c:out> tags?
Take the following snippet for example:
<img src="<c:out value='${initParam.categoryImagePath}${category.name}.jpg'/>"The same snippet without the <c:out> tag produces the same output in a browser:
<img src="${initParam.categoryImagePath}${category.name}.jpg"I understand that <c:out> also enables you to escape XML content, but if this isn't required, should the <c:out> tag be used? Are there any 'best practice' concerns involved?
Many thanks for any replies!

It is for historical reasons.
The Expression Language EL was originally only available as part of the JSTL tags, ie you could only use it with a <c:out> tag or similar.
That was JSTL1.0
As of Servlet2.4/JSP2.0 (eg Tomcat 5) EL expressions became part of the JSP specification, and containers had to evaluate them as runtime expressions.
That was one of the major changes with JSTL1.1
By all means if the value doesn't have to be escaped for HTML purposes, then I would say use the expression without the tag.
BTW your example leads to repetition. Maybe that should be made into a custom tag? <my:img image="${category.name}"/>
cheers,
evnafets

Similar Messages

  • Help writing javascript with c:out tag

    Hi
    I'm having trouble mixing javascript and jstl and could use some pointers!
    I need to write a flash object tag on the fly using javascript, and to also use <c:out> to define the flashvars parameter.
    So for example, at the top of my page I do something like this:
    <c:set var="thispage" value="home" scope="request"/>
    and then later, in javascript I have something like this:
    <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','1017','height','712','id','index','align','middle','src','index', 'quality','high','bgcolor','#E9E8EB','name','index','allowscriptaccess','sameDomain', 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'movie','index','flashVars','page=<c:out value=${\22thispage\22}/>' ); //end AC code
    </script>
    NOTE: the relevant part of this script is this area:
    'flashVars','page=<c:out value=${\22thispage\22}/>'
    The issue isn't the javascript; this all works fine and content is getting pulled into flash. The problem is that the content getting pulled in is literally "<c:out value..." blah blah..., not the variable that I had earlier assigned to it.
    In another thread I read that I need to request the variable from the app/session scope, but I'm not 100% sure of how this all works out. I have tried several things and it's either my jstl or encoding issues that keep causing failures. Assistance for a noob is appreciated!

    Certainly it is possible to do I18n with both struts and JSTL.
    With struts bean:message tag, you need to declare the application properties file in your struts-config.xml
    <message-resources null="false" parameter="com.locale.equipment"/>
    What is your properties file called?
    Where have you put it?

  • Airport Express with optical out?

    I've been looking at doing some streaming music throughout my house. I was thinking the Airport Express would work since it has optical out then it could outpout to one of my other stereo systems. However after looking around I can't find it anymore.
    Did Apple discontinue the Airport Express that plugs into the wall and has the optical out?

    Did Apple discontinue the Airport Express that plugs into the wall and has the optical out?
    Yes, a new version....with a power cord..... and a lot more....was introduced in June.
    AirPort Express
    You can still get refurbished versions of the disontinued model...with "new" warranty from the online Apple Store.
    http://store.apple.com/us/browse/home/specialdeals/mac/mac_accessories

  • Digital outs in Logic Express with 828 or 002 rack

    Can someone tell me if it is possible to use the digital ins and outs of either my MOTU 828 or DIgi 002 rack with LE? It's no where as easy as Pro tools or DP!!

    Forgive my naivety... when you say "digital outs" are you talking about SPDIF? Does this mean I can't run Logic Express with an interface connected to the SPDIFs on my G5? Only Pro? Or am I off the mark?
    Thanks!

  • I have just bought a 2011 iMac (2.5 ghz, 4gb) and logic express 9, and when i installed logic and tried to run it i had a message saying 'you can't use this version of the application logic express with this version of Mac OS X. How do i sort this out!?

    I have just bought a 2011 iMac (2.5 ghz, 4gb) and logic express 9, and when i installed logic and tried to run it i had a message saying 'you can't use this version of the application logic express with this version of Mac OS X. How do i sort this out!? It is very frustrating as the main reason i have bought  a mac is to use logic! Any help would be great as i am a complete novice when it comes to Macs!

    You're probably on OS X Lion?
    I had the same problem as you. I used Software Update to update Logic Express to the latest version, and then it ran without any problems.

  • Rendering A JPEG image with a custom tag

    Hi All,
    I have dilema. I'm trying to rendering a jpeg in IE/FireFox with a custom tag that I developed. I'm able to access the bean and invoke the getter method to return the InputStream property. But what gets rendered is the byte code not the image. I've tried just about anything I could think off. If any body has an answer I would difinitely appreciate it.
    Thanks,
    Tony
    Below is the jsp, tld, bean and tag.
    ********************************* image.jsp ****************************************
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ taglib uri="/WEB-INF/custom-chtml.tld" prefix="chtml" %>
    <html>
    <head>
    <title>HTML Page</title>
    </head>
    <body bgcolor="#FFFFFF">
    <chtml:img name="photo" property="file"/>
    </body>
    </html>
    ********************************* custom-chtml.tld **********************************
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>chtml</shortname>
    <tag>
    <name>img</name>
    <tagclass>com.struts.taglib.CustomImgTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
    <name>name</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>property</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    **************************** MemberPhotoBean.java ******************************
    import java.io.InputStream;
    * @author tony
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class MemberPhotoValue {
         private String memberId;
         private int fileSize;
         private InputStream file;
         public MemberPhotoValue() {
         public MemberPhotoValue(String memberId, InputStream file) {
              this.memberId = memberId;
              this.file = file;
         public MemberPhotoValue(String memberId,int fileSize,InputStream file) {
              this.memberId = memberId;
              this.fileSize = fileSize;
              this.file = file;          
         public String getMemberId(){
              return memberId;
         public void setMemberId(String memberId) {
              this.memberId = memberId;
         public int getFileSize() {
              return fileSize;
         public void setFileSize(int fileSize) {
              this.fileSize = fileSize;
         public InputStream getFile(){
              return file;
         public void setFile(InputStream file) {
              this.file = file;
    *************************** CustomTagHandler.java ********************************
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import java.lang.reflect.Method;
    import java.lang.reflect.InvocationTargetException;
    import java.awt.image.*;
    import java.awt.*;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.*;
    * JSP Tag Handler class
    * @jsp.tag name = "CustomImg"
    * display-name = "Name for CustomImg"
    * description = "Description for CustomImg"
    * body-content = "empty"
    public class CustomImgTag implements Tag {
         private PageContext pageContext;
         private Tag parent;
         private String property;
         private String name;
         private Class bean;
         public int doStartTag() throws JspException {
              return SKIP_BODY;
         public int doEndTag() throws JspException {
         try {
         ServletResponse response = pageContext.getResponse();
         // read in the image from the bean
         InputStream stream = (InputStream) invokeBeanMethod();
         BufferedImage image = ImageIO.read(stream);          Image inImage = new ImageIcon(image).getImage();
         Graphics2D g = image.createGraphics();
         g.drawImage(inImage,null,null);               
         OutputStream out = response.getOutputStream();
    // JPEG-encode the image
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(image);               
         out.close();     
    } catch (IOException io) {
              throw new JspException(io.getMessage());
         return EVAL_PAGE;
         public void release(){}
    private InputStream invokeBeanMethod() throws JspException {
         try {
         Object bean = null;
         if (null != pageContext.getAttribute(name)) {
         bean = (Object) pageContext.getAttributename);
         else if (null != pageContext.getSession().getAttribute(name)) {
         bean = (Object) pageContext.getSession().getAttribute(name);
         else if (null != pageContext.getRequest().getAttribute(name)) {
         bean = (Object) pageContext.getRequest().getAttribute(name);
         else {
         throw new JspException("Bean : "+name+" is not found in any pe.");
         Class[] parameters = null;
         Object[] obj = null;               
         Method method = bean.getClass().getMethod("getFile",parameters);
         return (InputStream) method.invoke(bean,obj);
         } catch (NoSuchMethodException ne) {
         throw new JspException("No getter method "+property+" for bean : "+bean);
         } catch (IllegalAccessException ie) {
         throw new JspException(ie.getMessage());
         } catch (InvocationTargetException ie) {
         throw new JspException(ie.toString());
         public void setPageContext(PageContext pageContext) {
              this.pageContext = pageContext;
         public void setParent(Tag parent) {
              this.parent = parent;
         public Tag getParent() {
              return parent;
         public void setProperty(String property) {
              this.property = property;
         public void setName(String name) {
              this.name = name;
    **************************************************************************************

    If you have access to an image editing tool such as photoshop, I would advice you import the image into Phototshop and save it in a different format e.g, GIF format and re-import it into Final Cut Express HD. This could solve your rendering problem if all you need is to use a Still image.
    Ayemenre

  • Why can I not disable the guest user in the 10.8.2 update? I have never enabled the guest user, but after the update, it was automatically enabled with a "managed" tag. It is not selectable even after entering my admin password to unlock the options.

    Why can I not disable the guest user in the 10.8.2 update? I have never enabled the guest user, but after the update, it was automatically enabled with a "managed" tag. It is not selectable even after entering my admin password to unlock the options. I was able to select the account under "parental controls", but again, could not delete it. Why Apple? Why?!!????

    SOLVED Ok. I actually was able to disable it. I had to actually log in as the guest user to make it accessible in the preference window. Then I disabled it and logged out. Apologies if this was obvious for some people, but I have had some sort of issue with something every update since Snow Leopard.

  • Why does my Alesis ioj2 express only come out through one side? When I sing into the microphone, it only comes out one side. I've set everything to stereo and it still has not solved the problem. Please help ASAP.

    Please help with my problem. I need to start recording!!

    Chris Huber wrote:
    Why does my Alesis ioj2 express only come out through one side?
    http://www.bulletsandbones.com/GB/GBFAQ.html#leftspeakeronly
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • How do I have to define a regular expression to filter out data from file?

    Hi all,
    I need to extract parts of lines of a ASCII file and didn't get it done with my low knowledge of regular expressions
    The file contains hundreds of lines and I am just interested in a few lines, within that lines I just need a part of the data.
    One original line looks like that:
    TP3| |TP_SMD|Nicht in Stueckliste|~TP TP_SMD TESTPUNKT|-|0|87.770|157.950|0|top|c| |other|TP_SMD|TP_SMD_60RF-TP
    Only the bold and underlined information is of interest, I don't need the rest.
    I can open that file, read in each line but then I am struggling to pick out only the lines of interest (starting with TP), taking that TP with its number and the coordinates following later on and then writing these shortened lines to a new text file. So the new line should look like that:
    TP3; 87.770;157.950;0 (It doesn't matter if the separator will be ; or |)
    I thought of using regular expressions - is that the right way or is there a better approach?
    Thanks & regards,
    gedi, using LabVIEW 8.5
    Regards,
    gedi

    Hi max,
    for finding a specific part of a string you can use the "Match Pattern" VI, it is located in the Strings Palette.
    Maybe the Extract Numbers.vi example in the examples browser library can help you.
    What I did to filter out my data of interest is first to sort out only the columns which I want to have -
    then there are still a lot of lines remaining I don't need (this is the thing described above).
    The rest I am going to filter out with a (then easy) regular expression with the "Match Pattern" VI.
    Regards,
    gedi
    Regards,
    gedi

  • Trying to set up Airport Express with Ethernet Powerline adapters

    Hello,
    Having some problems trying to set up my Airport Express with Netgear ethernet powerline adapters.
    I want to set up as follows:
    Wireless Belkin router --- powerline <---> powerline --- airport express --- home stereo system
    The problem I have is that I can connect the airport x in client mode & wirelessly play music using airtunes (until the sound breaks up) but itunes does not find the airport x when connected via the powerlines.
    I have airport admin utility configured as follows:
    Airport tab:
    Wireless mode: create a wireless network
    Wireless network name: same as my wireless router SSID
    Allow this network to be extended: unticked
    radio mode: 802.11n (802.11b/g compatible)
    Channel: automatic
    Wireless Security: WPA/WPA2 personal (as per my router)
    Wireless Password: as per my router
    Verify Password: as per my router
    Internet tab:
    Connect using: ethernet
    Connection sharing: off (bridge mode)
    Music tab:
    Enable Air Tunes ticket
    no password set
    In iTunes, I have home sharing on & share entire library selected with no password set.
    Using OS 10.6.5 & Airport Express 7.5.2
    I can ping the IP address of the airport express when connected via the powerlines but cannot select the speakers in iTunes (they are greyed out).
    Any assistance would be appreciated....
    Thanks

    Hi,
    Thanks for the quick response...
    As suggested, I connected up the Airport X to the Belkin and plugged in a pair of headphones. It didn't work, still could not select the Airport X as speakers.
    Dug out my old Netgear DG834G and connected that up in place of the Belkin - it worked. Next connected in the Netgear powerlines and it still worked.
    So, the problem is the relatively new Belkin F7D4401 router.
    Looks like I will have to find an alternative 802.11n...
    Thanks for your help.
    Regards
    Simon

  • Airport Express with printer & hard drive with Time Machine

    I have a MacBook that I'd like to backup its data. Concerned about the following (in level of concern from highest to lowest): theft, crash, fire.
    I currently have an Airport Express with a Brother printer attached to it that my PC and MacBook print to.
    I am really in a dilemma as to what to do. I was looking into Carbonite to get an offsite backup location of my data. (I figured offsite would cover all concerns of losing data due to theft, fire, or just a crash) However, Carbonite does not hold onto data you delete (ie, my photos and videos will fill up my hard drive eventually and I'd like to just archive them in one central spot when I am done accessing them on a regular basis-- ie delete them off my MacBook hard drive). That is like $55/year to do Carbonite... but, the only thing that will help me with over a hard drive in my house is a fire (and theft if a burglar were to find where my backup drive was in the house).-- Of course, I'd probably want a different location for my hard drive for that reason -- so, I'd have to buy another airport or just a time machine that has the wifi built in.
    I've read lots of issues with the Western Digital trying to download programs onto your computer... I have one for my PC that I backed up photos manually and it did try to install programs when I attached it to my PC... not so much my Mac when I took some photos off it. I looked into getting another portable hard drive at Costco for my Mac, but realized that it would require reformatting to use on my Mac (as it was built for a PC).... something I wasn't sure if I was computer-savvy enough to do or if I did do it, would I end up with issues later on?
    Anyhow... in the end, what do you all do to backup your data, especially photos and videos? Do you have smaller hard drives that you back up to and then when full move them to an offsite location? Can you have more than one "hard drive" backing up..... I was thinking it would be nice to have one larger hard drive that would potentially hold all my photos and videos so I can access anytime, but then have smaller drives of the same data that I can take to a safe deposit box and use as my super secure backup (no fire, no theft, no crash).
    btw, When doing time machine, does it keep all the metadata with each photo?
    Burning CD's is time consuming.... and, I have heard there are different qualities of disks out there... archival v. not... how long do the archival last v. the non-archival... or is that more of an issue for future generations not being able to access our photos?

    You need to remember that the Time Capsule is both a wireless router and a hard drive all in one enclosure. If you don't need a wireless router, around $150 of the $300 for a Time Capsule is going to be in the router portion of the device.
    The nice thing about the Time Capsule is that it is a network drive. All Macs running Leopard or Snow Leopard will be able to back up automatically to a single device. The first generation of Time Capsules about two years ago had some power supply problems that affected some users. Apple announced a program for these users to replace their Time Capsules.
    So, it depends on your requirements. If you are looking for a new, dual band wireless router and want to backup your Macs running Leopard or Snow Leopard automatically using ethernet or wireless, the Time Capsule is a logical choice.
    If you don't need a new router, then you'll need to look at a separate hard drive that will be attached directly to the computer using the USB or FireWire port. If you have two Macs, you'll have to get two hard drives if you want to do Time Machine backups correctly.
    Most hard drives can be reformatted to work with Mac if you don't mind a few extra steps and Disk Utility (Macintosh HD > Applications > Utilities > Disk Utility) does not look too complicated for you.
    Message was edited by: Bob Timmons

  • How to add multiple test conditions in 'test' attribute expression of xsl:if tag

    Hi all,
    How to add multiple test conditions in 'test' attribute expression of <xsl:if> tag ?
    I have 2 parameters and I want To skip the massage if this 2 conditions happened I tried to write it :
            <xsl:when test="($TransferToCompany = 0 and $ObjectInclide=1 )">
            <b1im_skip xmlns="" info=" Obect Will Not Transfer To company">
            </b1im_skip>
          </xsl:when>
    But I get an error while I am trying to transfer The object (Account) true B1if
    I am working with SBO 9 PL 13
    thank you
    shachar

    Hi saado
    Check this link:
    http://stackoverflow.com/questions/318875/can-you-put-two-conditions-in-an-xslt-test-attribute
    Kind regards,
    Radek

  • I can load an Applet .class file with an OBJECT tag...

    How can I load a .jar file? I foolishly believed I could replace "myclass.class" with "myjar.jar" in the <PARAM> tag associated with an <OBJECT> tag, and if I had created my manifest file correctly, the Main-Class in my .jar would have its init() method called upon IE load of the web-page. But alas, it is not that simple.
    Is there an incantation of the <OBJECT> tag that is appropriate for .jar files?
    Thanks in advance for any help you can provide in this area.

    Please ignore the duplication. My browser burped, and I can't seem to figure out how to delete a thread.
    See answer posted in other thread.

  • Airport Express light went out, stopped working.

    Airport Express light went out. iMac says the connection is "excellent," but it's not working (I use it to stream audio) and is getting very warm. Did it die?

    The usual cause of a dark LED is a failed AirPort Express. The reason your iMac reports an "excellent" connection is a mystery, but would be explained if it is actually connected to a different wireless network.
    The only potential remedy is a "hard reset" (see below). In rare occasions, repetitive and persistent attempts have been known to revive an ailing Express. There isn't anything else you can do. A "factory defaults reset" is identical, but is performed by keeping its reset button depressed while connecting it to power. Try that also.
    To "hard reset" an AirPort Base Station: make sure it's powered up, then gently press and hold its tiny reset button. Don't apply any more force than required to feel a tactile click.  Keep it depressed for five to ten seconds, long enough for its LED to flash amber rapidly. Release the reset button. Then, the LED will glow amber steadily for about a minute. Then, it will flash amber, slowly, about once every second or two, waiting for you to configure it with AirPort Utility.

  • Configure airport express with mac book air

    I am trying to configure airport express with a Mac Book Air, without success; the program is installed, but then, nothing appears to configure Airpor Express...
    Can I get any help? Thank you
    António

    Hello!
    I´m sorry it took so long to reply, but I´m new to these blogs; and I´ve been travelling a lot... Anyway, I was able to configure Airport Express, but I was told I could use it to expand my wireless network inside my house; which I found it´s not possible.
    So, I´m returning my Airport Express to the store tomorrow and try to figure out a way to extend my wireless in any other way.
    Any sugestion? Big houses are a problem...
    Best regards, and once again thank you!
    Antonio

Maybe you are looking for