0

I have a page A.jsp inside that there is a table which has 1 column: {Partner} , values: {trust,micros,NH}

all these values are (trust,micros,NH)hyper text links When i click on any value ,my action class called and it redirect to different jsp page B.jsp

B.jsp page contain data related to that value ex. (trust)

But for that i need to fetch data according to perticular value like select total_report from reservation where partner='trust'

so how will i pass that value on click from A.jsp to action class java file so that i can run that query. Using Struts framework

Please Help.

  • you mention action class.... are you using any framework? or simply using servlets.. – digidude Sep 27 '16 at 14:38
  • struts....i cannot use servlet – Shubham Pathak Sep 27 '16 at 14:40
  • this should help you.. http://stackoverflow.com/questions/9582999/how-to-access-url-parameters-in-action-classes-struts-2 so basically ActionSupport enables you to map request parameters to fields in your action class. you can just pass the values as a part of your request and retrieve in your action. Also you can use OGNL mapping to map one of the fields in your action class to a hidden field in your jsp and just set the value for that field during form submission on your jsp. Hope that helps – digidude Sep 27 '16 at 14:44
  • also when you say hyperlink, struts requires the navigation to be controlled via actions. you don't simply redirect to B.jsp on clicking on a link. you should call an action which does some processing and then returns sucess or failure depending on which struts navigation to B.jsp either happens or fails. hope you get the idea. – digidude Sep 27 '16 at 14:57

1 Answers1

1

I suggest you to use query-string in hyperlink

href should be like this

http://so.com/javascript?partner=trust

Action Class should be like this

public class MyAction extends ActionSupport{

 private String partner;
 //getter and setters   

}
Sanka
  • 1,294
  • 1
  • 11
  • 20