0

help with servlet

asked 2009-09-15 13:11:57 +0800

kar gravatar image kar
66 2

Hi all, I’m new to zk and I’m trying to convert my old servlet.

Graphic layout apart I have no idea how to perform the following tasks:

- An init phase where I will load files and init variables that will be used by following requests;
- Access those init variables (logs name / the list of loaded files) from my main zk file when this will be called

One more thing …
My old servelt is called from external component via post … how can I do this via zk … I can keep the old CORE servlet just for the main computation with no problem … just to know if I can achieve the same result in a better way.

Many thanks
Kar

delete flag offensive retag edit

3 Replies

Sort by » oldest newest

answered 2009-09-16 01:08:42 +0800

joylo0122 gravatar image joylo0122
688 1
www.zkoss.org

@kar

Override a init() method is a function to init things in servlet, but if you want to do the same thing in ZK Composer,
you can extend a GenericForwardComposer and init your variables or anything you want. ( Reference ZK-Composer )

ZK will work with Servlet, they control different parts in a web application. You can take any ZK Component as a Object,
composer will help developers easier to use component~~

(sorry for my poor English, wish you can get the point seriously)

Regards
/Joy

link publish delete flag offensive edit

answered 2009-09-16 07:53:59 +0800

kar gravatar image kar
66 2

updated 2009-09-16 07:54:26 +0800

thanks for the answer ...

i still have one more question left ...
let's say i have a composer which init a few variables ... what is the right way to read this variables from the servlet. shall i create application variable or what?

thanks again
carmelo

link publish delete flag offensive edit

answered 2009-09-16 09:57:41 +0800

joylo0122 gravatar image joylo0122
688 1
www.zkoss.org

@kar

There's a suggestion to help you to understand what is ZK-Composer.
The process about view, servlet and composer should be "index.jsp -> Servlet -> Composer", it's not possible
to get variables when you're in a Servlet state. If you want to init a few variables who's used in servlet, you should
write at init() method in servlet, or setAttribute() or setParameter() with a request.

Regards
/Joy

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-09-15 13:11:57 +0800

Seen: 190 times

Last updated: Sep 16 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More