Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question related to s:select and s:action

 
garrick chen
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you be more specific as to what's actually happening? I don't understand the problem yet.
 
garrick chen
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic