*
The moose likes Servlets and the fly likes Passing values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Passing values" Watch "Passing values" New topic
Author

Passing values

Edwin Abraham
Greenhorn

Joined: Jun 30, 2003
Posts: 4
Hi,
i have a "test.jhtml" file in that i have serverside includes like
<servlet code=abc ></servlet> now iam passing(typing in the addressbar) suppose say
"test.jhtml?id=101 " ....how does my "test.jshtm " get that value of " id " so that i can use that value in my "abc " class file included in "servlet tag"
Regards
Edwin.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
since what ever you passed thru URL it stores in request since you are passing thru URL and default parameter passing is GET method so, servlet class takes all the parameters given in the URL and it will access those parameters thru request object.
Regards,
venkat

Originally posted by Edwin:
Hi,
i have a "test.jhtml" file in that i have serverside includes like
<servlet code=abc ></servlet> now iam passing(typing in the addressbar) suppose say
"test.jhtml?id=101 " ....how does my "test.jshtm " get that value of " id " so that i can use that value in my "abc " class file included in "servlet tag"
Regards
Edwin.

henley
Greenhorn

Joined: Jul 06, 2000
Posts: 16
Actually, you cannot do this. Since you are using JHTML, the only way to get the value of the request parameter is through JavaScript, and since JavaScript code won't be executed until the page gets to the client, it will be too late for the <SERVLET> tag process it. All <SERVLET> tags must be static, unless the server you are using provides a mechanism for making them dynamic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing values