Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 22nd, 2007, 09:55 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
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




Reply With Quote
  #2 (permalink)  
Old March 23rd, 2007, 07:34 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:20 AM.


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