Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hyperlink calls database

 
biswajit goswami
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah.....there r multiple hyperlinked userids,which if clicked should search a database and display the corresponding data.To search the database ,i need the userid in some bean or in some attribute??how to send the corrresponding userid to a bean through clicking a hyperlink.
eg: click hyperlinked<AS009> and i get the details of AS009 displayed in a new jsp
 
michelle Wang
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, do you know what is MVC structure? Struts is based on it and developed. Your JSP cannot directly call DB to do the search function right? So you will need a "action" class to handle the user request on the server side. So you can put the value u want pass to DB into a attribute with a request in JSP, like this:

<a href="../action/ShowClientProfileAction.do?clientID=<%=clientID%>">

Then in your action class, you may need to get the attribute first, like this:

int clientID = Integer.parseInt((String) request.getParameter("clientID"));

from here, your action class can use the clientID and call DB class to do the search function already.

Hope this helps.
 
biswajit goswami
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for the solution........But if it is desired that there should be no getparameter in the action class and that all the input paramters should be fetched from a Form class then is there any solution?
 
michelle Wang
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I only make use of the action Form that when the first page is really a "Form", which means the page has text fields, check box, dropdown menu these user input elements and you need to validate them. Nobody say when using struts must follow every thing inside right? I just combining all the knowledge i know and choose the most suitable one to make it works, that's all.
 
pankajjj jain
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI

you can put the userid in a text box by java script and textbox can be easily fetched by Action Form
 
biswajit goswami
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for ur replies.Jain,my situation does not permit ur solution.Wang i too feel that i should directly take the attribute in the action class using getParameter.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic