This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help regarding getParameter-How to use servlet concept in Struts2 Action

 
ishan grover
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! all, I Have a problem regarding getparameter. How to access values of textfield through request.getParameter
Please consider the code of jsp as below :



Javascript code:


Java Code:

I am new in Struts2 and don't know how to use servlet concept in Action class.however, I am able to call Action class but not able to retrieve values through getParameter.
Please Help me regarding this.Thanks in Advance
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to small example first with struts2. Where is execute method in ActionClass? Why are you calling doGet method here? How to get the request object in Struts2?
 
ishan grover
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohana Rao Sv wrote:Try to small example first with struts2. Where is execute method in ActionClass? Why are you calling doGet method here? How to get the request object in Struts2?


Actually i want to retrieve list of cities on the basis of dynamic value of textbox.I am trying to implement through ajax. The execute function id down below in action class. I have replaced doget method with execute method as follows
CityAction.java



Now I am getting values from:


The DAO class is as follows where i am fetching cities:
DAOcity.java


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic