• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help .

 
Robert Darling
Ranch Hand
Posts: 100
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Robert Darling
Ranch Hand
Posts: 100
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help.

another question does struts search in any particular order like 1) session 2) formBean etc.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help. thats something that i will avoid doing as well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic