You can write a base action and have every action extends it. And do this in your execute() method:
Calendar cal = Calendar.getInstance(); Date currDate = cal.getTime(); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy"); String showDate = df.format(currDate); request.setAttribute("showDate", showDate); If you think use a base action make your code ugly you can write a servlet filter and configured it in web.xml. And write a bean:write tag in your JSP: <bean:write name="showDate" /> On 6/6/07, Raghupathy, Gurumoorthy <[EMAIL PROTECTED]> wrote:
http://jakarta.apache.org/taglibs/doc/datetime-doc/intro.html -----Original Message----- From: Ambaris Mohanty [mailto:[EMAIL PROTECTED] Sent: 06 June 2007 08:54 To: 'Struts Users Mailing List' Subject: RE: display current date in header Thanks for your solution. It works fine. But I want to do it without using scrip lets. How to do? AM -----Original Message----- From: Norbert Hirneisen [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 06, 2007 12:01 PM To: 'Struts Users Mailing List' Subject: RE: display current date in header In your jsp: <%@ page import="java.util.Calendar"%> <%@ page import="java.util.Date"%> <%@ page import="java.text.*"%> <% // current Date Calendar cal = Calendar.getInstance(); Date currDate = cal.getTime(); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy"); String showDate = df.format(currDate); %> In the html-body: <p><%=showDate%></p> Regards, Norbert Norbert Hirneisen science4you Online-Monitoring Please visit us: http://www.science4you.org (in German) Norbert Hirneisen Science & Communications von-Müllenark-Str. 19 53179 Bonn phone +49-228-6194930 -----Ursprüngliche Nachricht----- Von: Ambaris Mohanty [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 6. Juni 2007 07:26 An: 'Struts Users Mailing List' Betreff: display current date in header Hi all, I'm using struts 1.2.9 along with Tiles. I want to display current date in the header page. Can anybody tell me the best approach to do so? Thank you, AM --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]