0

i try to change this scrip into jsp but i stuck at switch statement - switch ($_GET.. Please someone help me.. (T_T)

menu.php

<li><a href="index.php?action=home">Home</a></a></li> 
<li><a href="index.php?action=aboutus">About Us</a></a></li>

index.php

<td width="20%" valign="top">
    <?php include ('menu.php'); ?>
    </td>
    
    <td width="85%" valign="top">
	<?php
    	switch ($_GET['action']){
		case 'aboutus': 
				include 'aboutus.php';
				break;

		case 'home':
				include 'home.php';
				break;

     		default:
				include 'home.php'; 
        }
	?>

Edited by reezox: n/a

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by reezox
0

Do you have any knowledge of java? Or any other programming language? The switch is the classic switch statement that you will find in any language. You will need to use scriplets. Try to find and read a book about jsps. If you are unfamiliar with java then you shouldn't be writing jsp and you should be learning java first.
I believe that someone should be very good in java before going to jsps

0

Do you have any knowledge of java? Or any other programming language? The switch is the classic switch statement that you will find in any language. You will need to use scriplets. Try to find and read a book about jsps. If you are unfamiliar with java then you shouldn't be writing jsp and you should be learning java first.
I believe that someone should be very good in java before going to jsps

yes i know. what i means is how to display multiple page with one layout for example index.jsp?action=about is that jsp do not use switch to do that?

0

i found the solution.. jsp is using request.getParameter()

when i click register link (menu.asp) it will include register.asp file in the index.jsp
the url will be like this http://.../index.jsp?page=register..
by default it view a home.jsp..

menu.asp

<a href="index.jsp?page=register">Register here!</a>

index.jsp

<% 
   if (request.getParameter("page") != null) {%>
     <%@ include file="register.jsp" %>
     <% }
   else { %>
     <%@ include file="home.jsp" %>
   <% }
%>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.