• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am Anitha I have a task If I click one option box like country then corresponding states to appear,than I click states than next option box must display cities.please see this link you will get an idea http://www.bharatbloodbank.com/search.php How to do it in struts.based on this
You replied it is easy in AJAX but iam not perfect in AJAX but i wrote some code in Struts is it correct process or not will you provide correct process to me

import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public final class SearchAction extends Action
{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws Exception

{
EmployeeSearch

if (templateList != null && !templateList.isEmpty())
{
templateLable = new ArrayList();
for (int i = 0; i < templateList.size(); i++)
{
List state=new arraylist();
state.add("Andrapradesh");
state.add("Kashmir");
state.add("Maharashtra");
state.add("Uttarapradesh");


Template lableValueset = (Template) templateList.get(i);
if (lableValueset != null)
{
LabelValueBean lvb = new LabelValueBean(lableValueset.getTemplateName(),
lableValueset.getTemplatePkey().toString());
templateLable.add(lvb);
}
}
request.getSession().setAttribute("TEMPLATE_LIST", templateLable);


In above code where can i add states,cities,countries please give me correct Idea.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anitha,

As per the requirement you hav posted,

When an first option box is clicked

a new set of Collection is need to be loaded,

so when the First OptionBox is Clicked (Using OnClickOption)- It need to be forwarded to a new

Action - Where it can load the another set of Collection for the Next

OptionBox. Similarly for other optionboxes.

NOTE:
The Values of the optionbox need to be Persisted every time a new Click is made.
 
reply
    Bookmark Topic Watch Topic
  • New Topic