This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Array syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Array syntax" Watch "Array syntax" New topic
Author

Array syntax

Noopur Kore
Ranch Hand

Joined: Aug 18, 2012
Posts: 77

I'm trying to pass an arraylist from servlet to jsp. I want to print items from this arraylist in <input> tag.



How is the syntax supposed to work here? My IDE is showing an error at this one? I'm new to this, how does the syntax actually work? :confused:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Scriptlets are over 12 years out of date. You should be using the JSTL and EL.

Using the EL, and assuming that the List is in scoped variable named whatever, the syntax to fetch a particular element would be: ${whatever[n]}, where n is the index.

For using scriptlet expressions -- which you should not be doing anymore, after all it's 2013 -- your code is missing the equals sign in the syntax.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Noopur Kore
Ranch Hand

Joined: Aug 18, 2012
Posts: 77

Thanks Bear, Lot more to learn.
:)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array syntax
 
Similar Threads
Multiple buttons... how does the actionlistener handle it?
data structure of choice.
Replace a char in a String
can we have array of ArrayLists
handling the input type check box in struts