my dog learned polymorphism*
The moose likes Struts and the fly likes What is 'lookup for a class' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "What is Watch "What is New topic

What is 'lookup for a class'

M Mehta
Ranch Hand

Joined: Aug 03, 2006
Posts: 92

I have recently started learning struts. I have a very basic question. What does the term 'lookup a class' mean. How it happens in struts.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Me Mehta:
What does the term 'lookup a class' mean. How it happens in struts.

I suspect that what you're referring to is the fact that you idenitfy a class when you create a Struts action mapping, and then Struts "looks up" the class and executes the execute method on it. The term "lookup" refers to the way Struts finds the class in the class path, instantiates it, and then calls a method on it. Example:

<action name="myForm" path="/" type="com.mycompany.MyAction" />

Given this action mapping, when a user enters the URL, Struts "looks up" the class com.mycompany.MyAction, instantiates it, and calls its execute method.

Consultant, Sima Solutions
Don't get me started about those stupid light bulbs.
subject: What is 'lookup for a class'
Similar Threads
How to do JNDI lookup?
Using Helper class or a Interceptor for calling EJB from a Action class
Injection at Class Level
Integration of struts2..x with Ejb3.0
confused about security constraints and loginning in