• Post Reply Bookmark Topic Watch Topic
  • New Topic

RequestDispatching with EL ?

 
Bibhudutta Pradhan
Ranch Hand
Posts: 31
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How the above code could be replaced with EL ? or Any other way ?
Please help.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way to do this in a JSP with the JSTL or the EL because you should not be doing it in a JSP!

Request dispatching is role of the controller, not the view. You should never be doing anything in a JSP except rendering view.
 
Bibhudutta Pradhan
Ranch Hand
Posts: 31
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your quick reply.

Now is there any ideal way to populate data in a drop-down-list at the very first visit of a jsp page form ??

I was doing like this
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't follow the logic. Why would you dispatch to a servlet if the list does not exist?

In any case, the logic should be as follows:
  • The page controller servlet obtains the list from the model layer.
  • The list is placed in request scope.
  • The servlet forwards to the JSP.
  • The JSP uses the forEach JSTL tag to iterate over the list.
  •  
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!