Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2007, 09:55 PM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to fever168
Default Problems on using parameter

Hi everybody,

I am a beginner of JSP,so please forgive I am asking some foolish questions as below.

I have read many JSP tutorial books and I seldom find a topic teaches us how to use a parameter to get a jsp page. Even there is, the content is very insufficient.

For example, I copy your link "http://p2p.wrox.com/post.asp?method=Topic&FORUM_ID=86"

It show the param"?method=Topic&FORUM_ID=86". I want to know how can I use one parameter to get the different contents within a JSP page?

Within a website there may be many different links, so it is difficult to manage if I create a new page for every link. And I heard that I could use a parameter to represent a page (eg.ID=1,2,3...) in order to show different content within the same template.

Is it difficult to understand my question? Am I not well to express my problem? Could you help me to solve it? I couldn't find any solution from the tutorial books in bookshop. Please help, thanks!

All the best
Roy




 
Old March 23rd, 2007, 07:34 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

You can use scriplets or custom tags for branching and check the parameter value to display different contents.for example

<%
int id = Integer.parseInt(request.getParameter("id"));
if(id == 1){
  out.print("Title One");
}else if(id == 2){
  out.print("Title Two");
}else{
 out.print("Title other");
}
%>

Mostly we use parameter values to get data from database for example id parameter value might be book id[primary key column] in a book store example and by getting the id value as parameter we use to construct a query and get the book data.

Hope i gave usefull info.

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter object malfunction - out parameter dash dev C# 2005 6 December 4th, 2007 12:58 PM
Problems with "SelectedValue" in Control Parameter rsearing ASP.NET 2.0 Basics 5 July 11th, 2007 09:30 AM
Parameter Problems Odifius Access VBA 2 October 10th, 2006 03:54 PM
validate.asp problems and logon.asp problems p2ptolu Classic ASP Databases 0 February 16th, 2005 02:34 PM
Parameter Bhavin Crystal Reports 4 September 9th, 2004 10:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.