This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I develop a dummy mvc2 web application for school administration. I created a jsp welcome page (index.jsp)that contains a link to list all student. From this link, we will be directed to the controller servlet, namely SisdikController. How can i create this link so the controller servlet gets called ??
Here's my controller servlet:
and here's my web.xml:
In the controller, the request will be routed according to the request parameter given. In this case, i want the request param value to be 1 (VIEW_ALL_STUDENTS). How can I pass this value in my anchor tag ??
Is this form of anchor tag a correct one ??
My development machine: Windows xp Tomcat 5.5 JRE 1.5 Thanks in advance..
How can i create this link so the controller servlet gets called ??
You Already have an answer for this. The mapping you have done in the DD should hold good for this.
How can I pass this value in my anchor tag ??
You generally do it this way in your case....
Generally, all the input fields in your jsp form will be passed as the request parameters to your servlet. [ May 28, 2008: Message edited by: Prasad Tamirisa ]
Joined: May 21, 2008
Thanks Prasad for a quick response... I did manage to pass the request to the controller, and this controller passes the job to another method to do some processing (querying the database to select all students). I then tried to forward the request object which contains studentColl attribute. This attribute contains the collection of student objects queried from the database.
I found no error until I tried to access this attribute from jsp page, student-list.jsp. It throws these error: