aspose file tools*
The moose likes Struts and the fly likes Question related to s:select and s:action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Question related to s:select and s:action" Watch "Question related to s:select and s:action" New topic
Author

Question related to s:select and s:action

garrick chen
Greenhorn

Joined: Jan 16, 2010
Posts: 13
hello
i am trying to display customer and product info. on saveOrder.jsp
but only the customer(s:select) could display correctly
and on myeclipse only show a sql for customer
could anybody tell me how to fix it

CustomerSortAction


portion of saveOrder.jsp


bean
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Can you be more specific as to what's actually happening? I don't understand the problem yet.
garrick chen
Greenhorn

Joined: Jan 16, 2010
Posts: 13
yap thanks for your help first
now when i startup the tomcat , run the saveOrder.jsp
i got the exception below


i've checked the myeclipse then i found there is no sql(select from customer or product) shown on myeclipse's console
i don't know which step is wrong

my env
myeclipse8,tomcat6,spring2.0,hibernate3.3.2,struts2.0.14,postgresql

src/
bean
dao
daoImpl
service
serviceImpl
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Oh; I see. Don't do it like that. The action tag has a host of issues and in general shouldn't be used just to get view-side data. Get the data in the action that's actually executing and create action properties for it.
garrick chen
Greenhorn

Joined: Jan 16, 2010
Posts: 13
that means applicationContext.xml and struts.xml??
or could you please explain more

i know i have to execute action first
but i don't know how to do it
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

1) You're executing an action to get to the JSP that has the action tag in it.
2) You're using the action tag to populate some lists by calling service methods.
3) You're using those lists to fill some form field options.

I'm saying eliminate step 2, do the service method calls in the action from step 1.
garrick chen
Greenhorn

Joined: Jan 16, 2010
Posts: 13
ok but i still can't display the page correctly
then i found a help page on apache struts2 FAQs
how to repopulate controls when validation fail
now i use action tag and it works well
thanks for your help again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question related to s:select and s:action