File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Servlet Code

 
Michele Smith
Ranch Hand
Posts: 421
  • 0
  • 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,
 
Paul Clapham
Sheriff
Pie
Posts: 20161
24
MySQL Database
  • 0
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
  • 0
  • 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
Sheriff
Pie
Posts: 20161
24
MySQL Database
  • 0
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic