aspose file tools*
The moose likes Servlets and the fly likes  How to replace this scriptlets from EL in my jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark " How to replace this scriptlets from EL in my jsp?" Watch " How to replace this scriptlets from EL in my jsp?" New topic
Author

How to replace this scriptlets from EL in my jsp?

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
I am working in a mvc architecture, and i have included the following code in my jsp page

<%
Format formatter = new SimpleDateFormat("dd-MMM-yyyy");
Date date = new Date();
String date1 = formatter.format(date);

EditorDao edao = new EditorDao();
long l = edao.loadID();

%>
Since jsp+java code= bad,
So, how to replace this scriptlets from EL in my jsp??


kunal
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61603
    
  67

Date formatting is handled by the JSTL <fmt:formatDate> tag. Dealing with DAOs is something the controller, not the JSP, should be doing.

It's not always possible to simply take scriptlets that are performing inappropriate actions in the JSP and turn it into corresponding JSTL/EL. Frequently, the JSP must be refactored to remove the actions that should not be performed in the JSP and move them into controllers.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to replace this scriptlets from EL in my jsp?