• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help on calling javascript without any handler from JSP..

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am generating calendar using two for loops.(Dynamic calendar)


I need to display values from the DB into the cells of calendar dynamically, so I am planning to attach a AJAX call.

Am I able to call javascript function without any handler, because I am planning to call the javascript for every iteration of loop so that I can display the values from DB while populating the cells of the table.

If anybody wants to look at my code I can post it.
Thanks in advance.
mark
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a question in there?
 
Harish Maridi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes,

How do I call javascript function from jsp without attaching any handler to it?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't. JSP runs on the server in order to format the HTML page to be sent to the client. Any JavaScript needs to execute within the browser, long after the JSP has executed and the page has been sent as the request response. Perhaps this article can help clear up how JSP processing works.

Perhaps it'd be best to back up a bit and tell us what the real problem you are trying to solve is. That way a solution that can work can be devised.
[ June 11, 2008: Message edited by: Bear Bibeault ]
 
Harish Maridi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

I am giving a little background of my task. framework I am using is struts.
I have couple of jsps index.jsp and calendar.jsp.
I have data in DB which consists of three columns, say (date,ticketnumber,title).
Now I have a link in "index.jsp", when I click that link, it should farward the page to calendar.jsp , which will show calendar with current month and current date highlighted and I need to display the ticketnumber column from DB to calendar.jsp and it should place ticketnumber based on the date. for example I have a row (06/21/2008 4567890 sampleticket) for this row 4567890 should be displayed in calendar.jsp in june 21st cell. likewise it should display all the ticketnumbers in specified cells of calendar.

I am able to develop the code for calendar display, and its navigating perfectly fine with change of month and year too. I also developed a script for AJAX call for displaying the ticketnumber in cell of calendar.

As I said earlier I used two for loops to generate the calendar table (So it is dynamically generated one) .

My question is How do I call AJAX script everytime loop runs(approx 30 times).

Sorry for my bad language.
thanks.
-mark
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic