Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Struts2 and Ajax help

 
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I did small program, when I enter "Anderson" in text box , "Hi, Anderson will display on same page".

I created this program from number of source. I used Struts2 and Ajax.I dont know where is the error, I am learning this.

Index.jsp


Struts-config.xml


AjaxMethod.java
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you understand how Struts works? If not, this will be really difficult. So let's start with a basic Struts tutorial. Once you've got the basics down, it will be easier to add AJAX to the mix.
 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply,

Yes, I know struts2
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excuse me if I sound skeptical, but you made a couple of beginner-level mistakes in the code above, for example, Struts 2 will not invoke this method:

Can you make something like the above code work without AJAX? (yes, you'll have to reload the page).
 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right, I used struts1. Its not working.. Now I want to use struts2. But I know know how to send result to the index.jsp.

Please help me, I spent 1 week to do this.
 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In short I require such code in which I enter the name "anderson" in the same page "welcome andershon" should display.

flow :

(index.jsp)send "anderson" to -->(java file)Receive "aderson" in action class - > "Welcome anderson" in "index file"

Thank you

Please help, me I tried too much.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can always use something like DWR (Direct web remoting) for AJAX call in your app.

 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This same thing happened in your previous, nearly identical topic. I get the feeling you want us to write your code for you rather than guide you to find the answers yourself.
There are a lot of things that have to line up perfectly to get AJAX to work, and if you start with an incomplete understanding of how Struts works, you will never get AJAX working.
Again, my advice is to get something working without AJAX, then adapt the program to use it. Start with the basic Struts tutorial I linked above.
 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Joe Ess & Ayan Biswas

Thank you for suggestion, I think you are right, i have to give some time to struts2.

thank you
Hardik
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great. Feel free to ask any questions you have while you get up to speed.
 
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic