Consider a page consisting of a list of course names. Each of those are links which when clicked upon should open up a new jsp displaying information about the course. This of course is after retrieving details from an oracle table. How is the struts.xml to be modified during runtime?
Deepti Nelavelli wrote:How is the struts.xml to be modified during runtime?
You can't edit struts.xml file during application is running, you need a context reload if you did so.
Deepti Nelavelli wrote:
Consider a page consisting of a list of course names. Each of those are links which when clicked upon should open up a new
jsp displaying information about the course. This of course is after retrieving details from an oracle table.
So you're loading menu links from database, which is generally not seen as a good practice. Why don't you hardcode links into HTML/JSP pages?
Thanks for that. This is a courseware development website where people create their courses, upload content and then download it for use later, very similar to sites like moodle.com. I need to display information in this manner for a moderator to approve courses that are being created. These courses and their associated information is not known while coding and is dynamic. Is there an elegant way to provide this kind of a functionality?
K, Lets thought about creating a separate links (action mapping in struts.xml) for each course you add, If there are 10 users who adds 10 courses each, then its hard to maintain your struts.xml, So this solution is not at all feasible, recommended and not used, never.
Usually this things are done by using course Id and names which are passed (as a URL parameters) as per the course selected by user.
Here is How:
1. User adds course -> Course saves into db with auto generated Id/code (PK) (Database)
2. Admin retrieves courses which are not approved yet -> So it gets listed as (JSP page)
1. My Course
3. When admin clicks for approval, on above link, the "ApproveCourses' action gets called and you can do whatever you wants with course whose id is "1".
Joined: Apr 06, 2009
That seems to be a better way to do it. I'am new to struts 2 however.How is the course_id passed as a parameter to the URL? How do you construct a query to shoot to the database from the URL parameter course_id?