• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling jsp file based on user input

 
Sneha Durvasula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a html page with a radiobuttonlist.Based on the user's input on that I need to provide various input options..I have created JSP pages for the various options and was trying to use javascript.I am able to pass the input checked to the js script but couldnt proceed furthur.I am using struts2 framework.Can someone suggest some way of doing it
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it were me, I'd be using jQuery's .load() method to use Ajax to fetch the appropriate fragment to load based upon selection.
 
Sneha Durvasula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks..Can you give me an outline structure of the way you are talking about,I am a new programmer in this area and dont have much idea
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jQuery documentation is here.

The basics are that, in the event handler for the user event that will trigger the change, you call the .load() method with the URL of the JSP for the fragment you wish to insert.

If you are unfamiliar with JavaScript, you have a long learning curve ahead of you.
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jQuery is pure awesome.
An alternative is the Struts approach: it would be simple to have an action take the radio button input and forward to the appropriate JSP.
There are plenty of links to tutorials and documentation on our Struts FAQ page. If you are new to programming, your first step should be to familiarize yourself with the resources available and the basics of working with an API (be it Struts or jQuery or something else). You will save yourself a lot of grief in the long run if you build a strong foundation.
 
Sneha Durvasula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joe..I have done with Jquery and it worked
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic