Forums Register Login

Instantiate object without scriptlet

+Pie Number of slices to send: Send
Hi all,

I want to remove scriptlet from JSP page below.

But How I can instantiate DepartmentDTO using EL and JSTL?

thanks all

+Pie Number of slices to send: Send
If the class has a nullary constructor, you could instantiate an instance using <jsp:useBean>. But it's much more common for object instances to be created in the page controller for the JSP.
[ May 28, 2007: Message edited by: Bear Bibeault ]
+Pie Number of slices to send: Send
 

Originally posted by Bear Bibeault:
If the class has a nullary constructor, you could instantiate an instance using <jsp:useBean>. But it's much more common for object instances to be created in the page controller for the JSP.

[ May 28, 2007: Message edited by: Bear Bibeault ]



Thanks Bear for quick reply but...

- How I can call getList() using <jsp:useBean>?
- What is "page controller"? I don't use Struts. should I implements Listener and save Department object in attribute.

btw, I'm still newbies in these area. thanks again.
+Pie Number of slices to send: Send
 

Originally posted by Anthony Karta:

- How I can call getList() using <jsp:useBean>?



<jsp:useBean> will create the scoped variable. From that point, you'd use the EL to obtain properties, such as your list property.

- What is "page controller"? I don't use Struts.



You don't need to use bloatware like Struts to structure your app using the best-practice Model 2 pattern.

should I implements Listener and save Department object in attribute.



I have no idea what you mean by this, but don't make things needlessly complicated.
+Pie Number of slices to send: Send
Thanks for the tips. I figure it out.

Originally posted by Bear Bibeault:


I have no idea what you mean by this, but don't make things needlessly complicated.



I meant, add a servlet as context listener to populate departmentDTO.

This JSP will be the first page invoked from browser, I don't have servlet for this page - how I can apply Model 2 (MVC) pattern then?

thanks again.

[ May 28, 2007: Message edited by: Anthony Karta ]
[ May 28, 2007: Message edited by: Anthony Karta ]
+Pie Number of slices to send: Send
There really isn't any concept of a "first page". Are you talking about the "welcome page" that is displayed when no specific page is specified in the URL? In modern servlet containers, that can be a servlet.
+Pie Number of slices to send: Send
 

Originally posted by Bear Bibeault:
There really isn't any concept of a "first page". Are you talking about the "welcome page" that is displayed when no specific page is specified in the URL? In modern servlet containers, that can be a servlet.



Hi Bear,

by first page I meant is the form that generated by JSP (see my first post), only jsp, no servlet.

should I re-design it, so I have a controller servlet that populate the data, save it in request attribute and forward the view to JSP?

I think I'm getting your point.

thanks
+Pie Number of slices to send: Send
If the page expects any sort of preparation -- such as the instatiation of data elements -- it should have a page controller that does the setup on its behalf.
This parrot is no more. It has ceased to be. Now it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1321 times.
Similar Threads
onchange and form.submit() does not work
get all from select multiple
How to determine which button/menu cause a submit
problem getting all parameters from multiple select
Javascript Dynamic Dropdown Box validation
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:45:10.