wood burning stoves 2.0*
The moose likes Struts and the fly likes Please help . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Please help ." Watch "Please help ." New topic
Author

Please help .

Robert Darling
Ranch Hand

Joined: Jun 21, 2008
Posts: 100

Hi

I am supporting an application developed in struts 2. i cannot understnd a certain piece of code.

This code is in the Action File ...



the following code is in the jsp file.

Now here is my question . the property "reportType" for <html:select> is defined in the form Bean thats OK.
but the collection reportType for the <html ption> is in the session. How does struts know where to find this variable.




[ July 08, 2008: Message edited by: Sajjad Dar ]
[ July 08, 2008: Message edited by: Sajjad Dar ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
First of all, a correction. You told us this was a Struts 2 application, yet the JSP fragment you showed us is using Struts 1 tags. It's a Struts 1 application if it's using these tags. (version 1.2 is still Struts 1. Struts 2 is version 2.something).

Also, please use a meaningful subject line when posting. "Please help" means nothing to someone browsing the questions, and someone who knows the answer to your question may never read it because your subject line didn't adequately describe it. Also, these forums are searchable, and someone else having the same problem is more likely to find an answer with an accurate subject heading.

Regarding your question, the collection attribute of the htmlptions tag will look for a variable in any scope with that name. If the variable were in application or request scope, it also would have found it.
[ July 08, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Robert Darling
Ranch Hand

Joined: Jun 21, 2008
Posts: 100

thanks for your help.

another question does struts search in any particular order like 1) session 2) formBean etc.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I don't know the answer to that question, and the reason I don't is that I vigorously avoid having the same variable name in different scopes.
Robert Darling
Ranch Hand

Joined: Jun 21, 2008
Posts: 100

thanks for your help. thats something that i will avoid doing as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help .