I needs to populate values for listboxes , textboxes .. almost all the form input elements from my servlet . Because sending the object to the JSP page and populating the values for the input elements there (using any tag libraries JSTL) i found it difficult.
Is there anyway for setting all the Input Element values from the servlet itself? For example if i needs to set the value for textfield , then in my servlet
In my jsp page
or using any tag library also fine.
How can we achieve this type of functionality or any framework is available? Please help me.
Dilip Ganesh wrote: Because sending the object to the JSP page and populating the values for the input elements there (using any tag libraries JSTL) i found it difficult.
It should not be difficult. So instead of trying to find some other weird way of doing it -- which is most likely to be even more difficult because it's not natural -- makes no sense at all.
The best approach would be to try to find out what you are doing wrong that makes it difficult.
So what difficulties did you run into?
Thank you so much for your quick reply. In my servlet i am calling web services to fetch the data's. So i will get the data in xml format. For example if i wants to create a new person , in that page i will show the fields like Country , State all this fields values are coming from webservices only. So sending this XML values to JSP and parsing there i found some what difficult. If i am using JAXB also same , i needs to send the JAXBObject to my jsp page and i need to populate values there. I hope it is clear.
You should do all the XML parsing in the servlet, capture the data in normal Java objects, and send those to the JSP. In the JSP, the EL and JSTL can be easily used to consume this data.
The best way to always approach this is to make the servlet do all the hard work of massaging the data into a structure that makes it easy for the JSP to do its job. In other words, keep the JSPs as stupid as possible.