This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting DataSourcein jsp(struts) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting DataSourcein jsp(struts)" Watch "Getting DataSourcein jsp(struts)" New topic

Getting DataSourcein jsp(struts)

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

hai All,

commonly we will get DBConnection in action class using getDataSource(request) right? .but i want to get this connection in my struts jsp file..
is it possible?

because when i click the element(employee) of menu..i have to display all the employee(in employee.jsp) which are in this case you should not go any actionclass...(only you have to use javaclass) their any idea?

please anyone can explain to solve this problem?

thanks & regards,
Joe Ess

Joined: Oct 29, 2001
Posts: 8843

I don't think you quite understand what's going on here. Let's say we have a web page that displays a list of employees so we can select one and display his details (sound familiar?). We request the page with the list of employees, a Struts action is invoked, populates a list from a database and a JSP displays it. At the point that we actually see the list, it's just HTML in a web browser. There's no persistent connection between our browser and the web server or database that we can use to populate the employee's details. We need to make another request from the web server so we can either load another page (conventional web apps) or request an XML document and manipulate the current page (AJAX).
[ April 04, 2008: Message edited by: Joe Ess ]

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

thanks Ess

I agree. Here's the link:
subject: Getting DataSourcein jsp(struts)
Similar Threads
Is this a good approach?
what could be the better way of saving data using jsf
how to push object onto Valuestack for OGNL access
How Struts will identify Class (with get / set methods) associated with it
Use download link to get data in CSV format in JSP page