File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 618
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: 60045
    
  65

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?
 
Similar Threads
Improving jsp Skills
Way to pass parameters to a bean in JSTL?
NumberFormatException while inserting data into database
Can't get familiar with Expression Language
How to replace this scriptlets from EL in my jsp?