File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes 2 Part Question 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 "2 Part Question" Watch "2 Part Question" New topic
Author

2 Part Question

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

1. I have a form that requests 2 entries. When I submit this, I also need to send one other value along with the other 2 that the user does not enter, but it will change with each dynamically built HTML page.
2. Can you send values to a servlet through <A HREF> without using a FORM?


GenRocket - Experts at Building Test Data
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Gregg
1. Can you use a hidden form field? It is an HTML input field who's type is 'hidden'. when the page is created set its value t wheatever you want it to be and it will be sent with the user inputs to the servlet.
2. If your dynamically building the href you can just append a '?name=value. Onto the end of it and then it is accesible through the request parameters.
hope that's what you're looking for


Dave
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

That's perfect Dave. Exactly what I was looking for. Thanks a bunch!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

If you use an <a> tag to invoke the servlet, be sure that you have implemented doGet().
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 2 Part Question