• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scriptless JSP tabindex  RSS feed

 
Howard Watson
Ranch Hand
Posts: 67
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there another way to achieve a scriptless JSP with tabindex on HTML forms?

This works well and has as little clutter as EL:

To me this introduces clutter:

Most of my javascript is client side data validation and I don't really feel good about building the JSP with javascript.
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If that code were inside a <c:forEach> element then you could get a counter out of that element. But I'm guessing it's not. In which case you could write a custom tag which returned the next sequential number every time it was called.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66149
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why the JavaScript in either case?
 
Howard Watson
Ranch Hand
Posts: 67
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul.

You are correct, it's a data entry form with a variety of HTML input types. Your idea of a custom tag is a learning curve for me, so for the time being if that is the only sciptlet code I have left in a data entry form I can live with that. I still have other form elements to deal with. I'm trying to upgrade my Tomcat 3 framework (jsp/servlet templates).

Thank you for your idea.
 
Howard Watson
Ranch Hand
Posts: 67
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear.

I mentioned JavaScript because it was one of the things I thought of try. I also came across a reference to a jQuery function to populate the tabindex. And some references to frameworks that supported this capability. To me this was seeming like a lot of work to beat one scriptlet. So in case I was missing something I posted the question here.

Where do you go to look up the hard questions?
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The hard question I have for you is: If you didn't assign any tab indexes to any form elements, wouldn't the default sequence correspond to their order in the document? And since you're generating and numbering them in that order, why do you need to number them at all?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66149
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that.

But if you do have a need to be explicit for some reason, using a mix of JSP and JavaScript is a big loser. Do it on the client in JavaScript or on the server in JSP, rather than a Frankenstein mix of the two.
 
Howard Watson
Ranch Hand
Posts: 67
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you both for your input.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!