Straight Problem

Here is a straight problem for my jsp:
This page include a tld file and 2 classes:
When i use the the tag with id ="item" it can normal generate the result
If I use other id tags, null will be returned
Here is my source code:
test.jsp
<html><head><title>An Iterator</title></head>
<%@ taglib uri='iterator.tld' prefix='it' %>
<body>
<% java.util.Vector vector = new java.util.Vector();
     vector.addElement("one"); vector.addElement("two");
     vector.addElement("three"); vector.addElement("four");
%>
Iterating over <%= vector %> ... </p>
<it:iterate id='anItem' collection='<%= vector %>'>
     Item: <%= anItem %><br>
</it:iterate>
</p>
</body>
</html>
iterator.tld
package tags;
import java.util.Collection;
import java.util.Iterator;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
public class IteratorTag extends BodyTagSupport{
     private Collection collection;
     private Iterator iterator;
     public void setCollection(Collection collection)
          this.collection = collection;
     public int doStartTag() throws JspException
          return (collection.size() > 0 ? EVAL_BODY_TAG : SKIP_BODY);
     public void doInitBody() throws JspException
          iterator = collection.iterator();
          pageContext.setAttribute("item", iterator.next());
     public int doAfterBody() throws JspException
          if(iterator.hasNext())     {
               pageContext.setAttribute("item", iterator.next());
               return EVAL_BODY_TAG;
          else
               try {
                    getBodyContent().writeOut(getPreviousOut());
               catch(java.io.IOException e)
                    throw new JspException(e.getMessage());
               return SKIP_BODY;
iteratorTagInfo
package tags;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class IteratorTagInfo extends TagExtraInfo{
     public VariableInfo[] getVariableInfo(TagData datas)
          return new VariableInfo[] {
               new VariableInfo(datas.getId(), "java.lang.Object", true, VariableInfo.NESTED)};
Iterator.tld
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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>Sun Microsystems Press Tag Library</shortname>
     <info>Iterate over a collection</info>
     <tag>
          <name>iterate</name>
          <tagclass>tags.IteratorTag</tagclass>
          <teiclass>tags.IteratorTagInfo</teiclass>
          <bodycontent>JSP</bodycontent>
          <attribute>
               <name>id</name>
               <required>true</required>
               <rtexprvalue>true</rtexprvalue>
          </attribute>
          <attribute>
               <name>collection</name>
               <required>true</required>
               <rtexprvalue>true</rtexprvalue>
          </attribute>
     </tag>
</taglib>
Also, there is a overriding problem in the iterator class, can anyone explain and solve the problem, thanks a lot.

The tag does not process the "id" parameter. There needs to be SetId() and getID(), then use whatever name was passed as the pageContext attribute name. Currently, the attribute name is hard-coded as "item".

Similar Messages

  • Downloading a file would bring up an option to open the file or save it - for some reason now it just downloads straight to the download folder. Why? Problem with Firefox or something else?

    Downloading a file would normally bring up an option to open the file with the appropriate program or save it - for some reason now it just downloads straight to the download folder. Why? Problem with Firefox or something else? It's very frustrating - sometimes you want the file opened first so it can be discarded or saved to a different location.

    Hey. that's great! Thanks for posting back with the outcome.

  • Problem with creating a straight line with polygamo lasso

    I am having a problem with polygamo lasso. when i create a triangle or a rechtangle in straight line it is turn out the line become not straight. I don't what did i wrong, was always working fine till today. YOu can see the pic the top line lookslike a step.

    Ihope I did right, was not sure how to save as channel.

  • I am having the problem when trying to take a panorama picture.   It may only take the first frame or doesn't even start at all when I press the shutter button. even though when i  hold the phone straight up and down, so that camera is at the top

    I am having the problem when trying to take a panorama picture. 
    It may only take the first frame or doesn't even start at all when I press the shutter button.
    even though when i  hold the phone straight up and down, so that camera is at the top on the back and the home button is on the bottom on the front.
    This problem is irritating me....?

    To take panorama
    - ensure that the panorama option is on
    - press the shutter button once
    - you will see a line with an arrow
    - move around in a circle  ( I keep the camera steady and turn myself around in a circle)
    - as you do this you will see the arrow moving across the screen as it captures pictures
    - at the end of the capture, you will be able to see your panorama picture
    I hope that this helps, do report back.

  • We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    To clarify for anyone who is still having any problems doing this.
    1. Unlock your phone with the carrier ( I know the process will work if it is jail broken but I am assuming you dont want to void the warranty on your phone) NOTE: even if you purchased the phone outright at Wal-Mart it is still locked to ATT so you will have to unlock the phone.  If it's already unlocked skip to step 2.  This works and will work even if you update the phone. 
    1a Here is the link to unlock a ATT iphone. Simply follow the instructions https://www.att.com/deviceunlock/client/en_US/
    2. Get a T- mobile SIM. Even if you don't want the service, if you feign interest, they will send you one for free or 99cents. If you need it now you can get one at a T-mobile store too.
    3. Once you have both your Straight talk SIM and your T-mobile SIM follow these instructions:http://www.youtube.com/watch?v=mFFf5uqk18M
    4. If you have any remaining questions look at all the responses posted previously on this thread or check out the Howard Forums Wiki: http://wiki.howardforums.com/index.php/Straight_Talk_iPhone
    Everything should work flawlessly at this point.  If not let me know and I'm happy to help when I can.  I hope this makes doing this very easy for everyone in the future. God Bless -J

  • I bought my iphone 4 through ebay and its unlocked. the problem is that my phone does not sync straight away. I sync my music file through autofill. I want to sync ringtones but its not working

    i bought my iphone 4 through ebay and its unlocked. the problem is that my phone does not sync straight away. I sync my music file through autofill. I want to sync ringtones but its not working.
    I saw cidya aap so i m not sure if it was jailbroken or not before but it is back to normal settings.
    My problem started when I tried to sync my music files. I pressed 'sync' all it says is waiting for sync start, preparing to sync and then waiting for the changes to be applied. but it does not sync at all.
    I found a way to sync my music files through autofill but I really wanted to sync ringtones but its not syncing and I really wanted to put ringtones in my phone please help.

    If you see the cidya app, your iPhone is hacked with the cutsie term for this being jailbroken. This also means all the built in security has been removed making the iPhone as insecure as an android device.
    Restore the iPhone with iTunes as a new iPhone or not from the backup to get rid of that hacking garbage. If the iPhone has hacked to be unlocked, the iPhone will no longer be unlocked when doing so.

  • Help please...iphone5 when trying to make a call, after hitting green button to make call, screen goes straight back to keypad and all incoming calls go straight to voicemail, any ideas please? Everything else seems ok. No problem with sim or carrier

    Hi...I have just obtained a secondhand iphone 5.  I'm not technically minded  and I don't understand 'geek speak' so please be gentle.  I have done all I can think of to bottom this problem. I have switched on and off.  Tried different o2 sims (including 2 brand new) that I know are fine, restored to factory settings, changed carrier from 'Auto' to O2 and spent ages on line with o2 chat but everything at their end is absolutely fine. Everything on the phone seems to be working apart from the phone aspect of things. All incoming calls go straight to voicemail and show on the phone as 'Cancelled calls' and when dialling out,  I can key in the numbers and get the keypad tone (not dialling tone) but as soon as I press the green key to make the call, all that happens is the keypad pops back up onto the screen. The phone was bought on ebay as an o2 phone (the photo showed Giffgaff on the phone's screen but I understand this to be one and the same?) and as being 6 months old but I have put the serial number into the support website and...surprise surprise..,it must be at least twice that age as the warranty has expired.  I have made 2 attempts to have a web chat with Apple Support,  have reached the 'You're all set, we'll be with you in 2 mins'  and have been left hanging there for over an hour on each occasion,  so I've given that up as a bad job!!  Any help will be much appreciated...and also, will Apple charge me £25 for each of the aborted chat attempts, please?  Over to you...hopefully and many thanks in anticipation.

    My phone works all fine when am in mumbai but as soon s i leave mumbai I am not able to make an otgoing call
    This is entirely a carrier issue.  If your carrier (airtel) doesn't provide service outside of Mumbia, this has nothing to do with your iPhone.
    i feel i need to change my brand
    This is a user-to-user tech support forum, not Apple.  No one here cares at all about your threats.
    NEVER post personal info in this public forum

  • Straight line problem in n8

    i have purchased nokia n8 two months before, now it shows a straight thin line in my upper screen and also the touch keypad buttons and other menu bar colour changed to light black, does anyone facing similar problem nd how to fix it, video quality is nt same after it

    Hi,
    Welcome to the forum!
    What happened to your N8 before it shows the straight line on the screen? Is there any instance that you accidentally drop your phone? Note that this can be the caused of the issue. In this case, you need to send your phone to the Nokia Care Point to have it physically assessed by the technicians. In addition, charges may apply for the out of warranty phones. 
    Visit this link for further assistance from your local support: www.nokia.com/support

  • Problem connecting two seperate straight line paths. Please help!

    Hi there, I'm new to illustrator and have been having a problem connecting two straight line paths. They never seem to line up correctly. Attached is a photo of the problem. I assume this is an easy fix but I can't figure it out myself.

    Brigid,
    There seems to be two aspects:
    One is to get the end points to coincide. You may tick View>Snap Guides, then click one path by the end Anchor Point and drag it to snap (Smart Guides say anchor when you are there).
    The other is to get rid of the gap in the stroke(s), You may join the paths into one, dragging across the coinciding Anchor Points with the Direct Selection Tool and Ctrl/Cmd+J, or you may keep the separate paths and change the Cap to Round in the Stroke palette/panel which will give you a rounded outer appearance); I presume the former is what you wish, in which case you may choose between Round and Miter Join.

  • PS CS4: Straight, hard lines instead of soft curves, history problems?

    Hi,
    sometimes Photoshop (Intuos 4, AMD Phenom2 X6 [email protected]) draws a hard line at full pressure instead of a soft, dynamic curve. It simply connects the starting and ending point. Painting ia 20000x14000@16GB Ram with PS using 12GB, painting size 6GB.
    I also experienced when going back history states with ctrl-alt-z the tool automatically switches to zoom, and sometimes history just jumps back to the latest state.
    Could this be a history lag? Any chance to fix this?
    Thanks!

    Before upgrading my machine and OS from Win7 to Win8 I had a similar problem, which was that the same thing happened, but there was part of that straight line missing. So there was a dot, break, and then the straight line. In between lies a new OS plus new hardware.
    So you suspect it's a Wacom bug?

  • Had to remove itunes from my computer to reset the computer. Now I'm having problems syncing my iphone with the computer. Computer is saying it wants to download updates to the phone but that will delete things I downloaded straight from the phone. Help!

    Had to remove itunes from my computer to reset the computer. Now I'm having problems syncing my iphone with the computer. Computer is saying it wants to download updates to the phone but that will delete things I downloaded straight from the phone. Help!

    iTunes thinks you have a new computer because you restored the OS. Open iTunes and authorize it to the same account you have on the iPhone. Did you restore your iTunes content from a backup after resetting your computer? Have you been syncing regularly with the computer, and does the iTunes library on the computer contain your apps, music and videos? If so just sync and your content will be removed then restored.
    If you have not hopefully you have now learned something. You can recover apps and purchased songs by connecting the phone, without syncing, and choose "Transfer purchases..." from the File menu.

  • Music cuts out after a few seconds or goes straight back to menu since I downloaded iTunes 11. Never had this problem since I bought apple tv 2 years ago.

    Music cuts out after a few seconds or goes straight back to menu since I downloaded iTunes 11. Never had this problem since I bought apple tv 2 years ago.

    Welcome to the Apple Community.
    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel.

  • Keying Problem, Keylight (Straight/Premultiply Alpha)

    Hi,
    I have the following problem:
    I used the Keylight-Keyer on my bluescreen-material. In the options, "Unpremultiply Result" is checked. Everything looks fine.
    When I export the Clip and import it in Flash, the .flv doesn't look like the clip in AE. (in fact, i think it already looks different right after exporting it from AE). There seems to be a halo around the actor, a gray edge.It looks exactly the same as when i turn "Unpremultiply Result" off in the keylight options.
    Somebody pointed out that it propably has something to do with straight or premultiplied alpha.
    Can somebody help me with this problem?
    Attached are 2 screenshots, one taken out of AE (with white background-layer), the other one in Flash.
    Thank you!

    I tried exporting it via "Export...", "Quicktime Movie", Animation, automatic keyframes, more than 16,7 million colors, quality best. This didn't seem to work.
    I don't find the command "Save Frame As...". I tried adding it to the render queue, where I found the options you mentioned. I chose: Adobe Flash Video, RGB+Alpha, more than 16,7 million colors, straight. Color management has "Keep RGB" checked.
    I just wanted to proof that this didn't work, since I tried it before. But now, preparing the screenshots for you, I notice that the halo is gone!!!
    Thank you very much!

  • Export Problem with Straight-Up QT File

    Hello
    Again just to clear up a mis-understanding;
    In regard to QT Files, it was recommended to simply 'Export' using a 'QT File'
    (no conversions of any type).
    For purposes of simplication here, the purpose of the file is for import into
    iDVD (perhaps Studio Pro later on).
    The material on the timeline is captured Mini DV footage with sound.
    I used to go thru the QT Conversions;
    QT conversion choosing DV/DVCPRO - NTSC 29.97, 'BEST' (I was misled here). All of these film clips were captured into FC from MINI DV Tapes. So in effect, each and every export took more time, and I suppose took up more space as well.
    It was recommended:
    "For what it's worth, I wouldn't export them to QT Conversion, which forces FCE/FCP to recode your video. I'd export to QT Movie instead."
    But do you guys know why my freind (with QT and FCE), cannot open straight up QT Files that I send him?
    (I think it's because the file I send him is designated as a QT FCP File?)
    How/Which/Type of file should I give him/Export for him that he can edit in FCE? Or iMovie?
    http://www.locationstudio.net/QT-Problem-1.jpg
    http://www.locationstudio.net/QT-Problem-2.jpg
    Thanx
    Mike
    Message was edited by: ENIGMACODE
    Message was edited by: ENIGMACODE

    Thank you
    In regard to my other comments;
    It's true that it isn't necessary to export as 'Self Contained' if the export is for my own usage here in my own system, (for later import into iDVD).
    As I understand it, because a QT Exported File is (only recognized), within my system (within FCP), it will not be recognized in my friend's computer (where he uses FCE, and iMovie - correct?
    Thanx
    Message was edited by: ENIGMACODE
    Message was edited by: ENIGMACODE

  • I'm opening up my Mac and it is going straight to Word for Mac and randomly opening multiple pages automatically.  I am unable to control it.  I think there is a problem.  I'm desperate to get into my work - any ideas?

    I'm opening up my Mac and it is going straight to Word for Mac and randomly opening multiple pages automatically.  I am unable to control it.  I think there is a problem.  I'm desperate to get into my work - any ideas?

    If you close all the windows and quit word, next time you restart, DO NOT check "Reopen windows on login".
    Also, check your login items for your user account.

Maybe you are looking for