aspose file tools*
The moose likes JSP and the fly likes how to add values  to servlet   and call that servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to add values  to servlet   and call that servlet" Watch "how to add values  to servlet   and call that servlet" New topic
Author

how to add values to servlet and call that servlet

maheshm morem
Greenhorn

Joined: Sep 23, 2010
Posts: 26
hi, i want to add some parameters to the servlet and calll it from jsp page , so how could we do it?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  17

You can generate a link to your servlet, like if the servlet is mapped to /myRequest, then you can add a code like

<a href="myRequest?param1=value¶m2=value">click here<a>

the two parameters that we've added after the ? mark can be retrieved from the servlet using request.getParameter

(I've ignored the context path to keep the example simple, the proper path to the servlet would be ${pageContext.request.contextPath}/myRequest )


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Or, submit a form.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to add values to servlet and call that servlet