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)
e.g COURSE_TABLE
2. Admin retrieves courses which are not approved yet -> So it gets listed as (JSP page)
Approve Courses:
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".
HTH
Deepti Nelavelli
Greenhorn
Joined: Apr 06, 2009
Posts: 5
posted
0
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?
Deepti Nelavelli wrote:I'am new to struts 2 however.
Me too
Deepti Nelavelli wrote:
How is the course_id passed as a parameter to the URL?
I had shown in the Link,
see "1. My Course" in previous reply.
Deepti Nelavelli wrote:
How do you construct a query to shoot to the database from the URL parameter course_id?
You looks like new to web application development, Still We can use JDBC in action class
Deepti Nelavelli
Greenhorn
Joined: Apr 06, 2009
Posts: 5
posted
0
Could you please send me links of where i can find examples of passing parameters to the url in a java class? I know it is possible in a jsp. Is using servlets in struts 2 for this purpose good?