Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Table in JSP

 
Nick Price
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about not saying my last topic was sorted, i am only going to ever post one question on one forum now so i dont make this mistake again.
With some much greatful help, i have gotten data return to my jsp and displaying in my browser. Now i am looking to neaten it up. So i know that doing this



It gets put in its own table. Buts say if i create my own table, rather than looping like the above, is it possible to do like (i know the onctentEditable is not correct, just using as example):


So pointing to an index for the returned variable.

Thats the main point i am after, but on a different note, just to get a better understanding, is JSP and servlets a universal framework, because the forEach loop looks like it comes from C or C++, and not java. And also i was reading in another post that a bean requires an non arg constructor. I have also noticed that everyone writes this constructor even if its their only constructor. If you didnt create this constructor (presuming it was the only one in your class), would a default one be created as usual?
cheers
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65340
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick Price wrote:it possible to do like...
What does the EL specification have to say about this? Did you try it? Is nationality or printResultItem the collection? How would this same expression look in Java?

And, why on earth would you want to to do that?

(i know the onctentEditable [sic] is not correct, just using as example):
An example of what? Throwing in extraneous fluff isn't a great way to create a clear example.

just to get a better understanding, is JSP and servlets a universal framework, because the forEach loop looks like it comes from C or C++, and not java.
Huh? That makes no sense. The forEach action is very reminiscent of Java's for-each loop.

And also i was reading in another post that a bean requires an non arg constructor.
Correct.

I have also noticed that everyone writes this constructor even if its their only constructor. If you didnt create this constructor (presuming it was the only one in your class), would a default one be created as usual?
Everyone? Really?

And, yes. a nullary constructor is created if the class has no other declared constructor.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not to mention that the 'contentEditable' attribute doesn't turn the div element into some input element or so that is capable of sending request parameters to the server side. Keep that in mind.

And yes, the printResultItem.nationality have to be an array or a collection to get the brace notation to work. Also here, the index usually starts with 0. For the rest I have nothing to add on Bear's reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic