Bean Running Prob


Web tier: servlets, JSP, Web frameworks: Bean Running Prob

  1. Bean Running Prob (2 messages)

    i have 2 files one is my class file CurrentTimeBean which looks like this

    Assume all packages are imported.

    public String getTime(){
       GregorianCalendar gCal = new GregorianCalendar();
       String timeFormat = "hh:mm:ss";
       SimpleDateFormat sDate = new SimpleDateFormat(timeFormat);
        gCal.add(Calendar.SECOND, 1);
        this.CurrentTime = sDate.format(date.GetTime());
        return CurrentTime
    public void setTime(String newTime)}
        CurrentTime = newTime

    and in JSP page i wrote following
    also assume that class has been improted thru useBean tag
    <jsp:setProperty name="time" property="CurrentTime" />
    i had installed Jakarta Tomcat

    when i run jsp page it shows me "can not find any information for property "CurrentTime" in the bean com.jsp.CurrentTimeBean"

    please let me know how can i use setproperty method so that i can overcome thsi prob. again i want to make timeBean so please let me know how can i make timerbean in JSP

    Thanks in adv.


    Threaded Messages (2)

  2. Bean Running Prob[ Go to top ]

    You are using the attributes of the <jsp:setProperty> tag incorrectly.

    name = name of bean
    property = name of property

    Your tags should be:

    <jsp:useBean id="CurrentTime" class="<your-package>.CurrentTimeBean" />

    <jsp:setProperty name="CurrentTime" property="time" />

    I am not sure this will solve all your problems, though, since I can't tell what you are trying to set the time for.
  3. Bean Running Prob[ Go to top ]

    i solved the prob. But can u tell me how can i write code for timer bean whcih continuously showing time on the page