Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Help with Servlet Code

 
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What am I looking at:




I am wanting to determine if these strings are being passed on the query string and if I needed to add a parameter, how to do so.

Thanks,
 
Marshal
Posts: 25823
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, in that code "req.getParameter(something)" gets one of the request parameters.

As for how they get into your application, that depends on whether the request was GET or POST (or one of the other more unusual methods). If it's a GET request then the parameters come in as parameters of the URL (probably what you meant by "on the query string") but if it's a POST request then they work somewhat differently.

As for adding a parameter, you can't do that in your servlet. You can only respond to whatever your client has sent. Now if that question was meant to be how to get the client to send another parameter, then it's a question about the client. About which we know nothing.
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Taking a guess, if you mean these lines:
Then yes, those are request parameters.

They can be set by the query string on a the request URL (in the case of a GET), or by form elements (in the case of a POST).

[Edit: Paul shot first while I was posting! ]
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I be sure that the parentid is passing? I have examined DMTemplateLoaderFLReports and it apperas to be passing a "1" as a parameter.

For example,

https://209.173.134.79:7001/DMTemplateLoaderFLReports?sdate=03/16/2010&edate=03/19/2012&caseid=0&homeid=1&parentid=1&userid=100059&mode=APA&documentFileName=1-EmbalmingReport.doc&homeId=<xsl:value-of select="../../Home/Id"/>&transId=NA&dmDocumentId=<xsl:value-of select="../../DMDocumentId"/>

 
Paul Clapham
Marshal
Posts: 25823
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what that enormous bit of code was supposed to mean. (Please don't post huge code samples, nobody wants to read them.) However in the URL you posted at the beginning, after the XSLT transformation was complete, there would be three URL parameters, namely "homeId", "transId", and "dmDocumentId". Actually I suppose there could be others if the XSLT transformation generated them, but the code doesn't look to me as if it would do that. It's not impossible, though, so the best way to see what parameters are being passed is to look at the actual URL which is generated rather than trying to figure out what the code might produce.
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic