Solved

Help with Servlet

Posted on 2012-03-21
8
331 Views
Last Modified: 2013-11-24
If I needed to pass an additional parameter on this, how would I go about doing it:

public void doAction( Context ctx, BcSQLAgent agt, HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException, Exception
  {
    SimpleDateFormat dateFormatLong = new SimpleDateFormat("MMMM dd, yyyy");

    String caseId = req.getParameter ("caseId");
    String homeId = req.getParameter ("homeId");
    String fileName = req.getParameter ("documentFileName");
    String dmDocumentId = req.getParameter ("dmDocumentId");
    String fileExt = fileName.substring( fileName.lastIndexOf(".") );
    String savedFileName = new String();
    String savedFileNameOriginal = new String();
    String savedFileNameNoSpaces = new String();
    String savedFileNameNoSpacesOriginal = new String();
    String templateFile = "fhfiles/templates/" + fileName;
    String tempString = new String();
    String generalDocumentType = req.getParameter ("generalDocumentType");

    WordTemplate oWW = null;

    String serverName = req.getServerName();
    Home h = ctx.getHome( agt );
    BcInteger _homeid = new BcInteger(ctx.getHomeId());

    Case c = new Case (agt);
    Package pack = new Package( agt );
    Properties _tagsByName = new Properties();
    TagHandler _tagHandler = new TagHandler( ctx, agt );

Thanks, Midani Tickabooma
0
Comment
Question by:Midani22
  • 4
  • 4
8 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 37748425
what kind of additional parameter do you need?
Thsi method (usually actully those are rather methods doGet()  or doPost())
is called by container, so you cannot modify the parameter list
I think you in theory  can have a setXXX() method in servlet, but why would you need it - you normally don't need it.
Explauin what it is you want to accomplish
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37748437
All parameters are normally coming from the form which user fills in and are passed through the Request object as you see in your own code
0
 

Author Comment

by:Midani22
ID: 37748498
The servlet controls the action for instance:

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"/>&amp;transId=NA&amp;dmDocumentId=<xsl:value-of select="../../DMDocumentId"/>


and this is the code. I need to make sure that the parentid parameter is getting passed. See attached script.
DMTemplateLoaderFLReports.txt
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 47

Expert Comment

by:for_yan
ID: 37748524
you just add

String dmparentid= req.getParameter ("parentid");

the same way you do it with caseid and homeid
0
 

Author Comment

by:Midani22
ID: 37748610
That's all?

Just double-checking everything.
0
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 37748658
>That's all?
if you are passing this way caseid and homeid why not to pass the same way parentid?
Thsi is normal way how parameters get into the servlet

I would rather normally use doGet() method in such aceses but idf it works this way then fine



>Just double-checking everything.  
what that means?
0
 

Author Comment

by:Midani22
ID: 37748662
means just trying to get cha to confirm your answer. Thanks a lot! :)
0
 

Author Closing Comment

by:Midani22
ID: 37748665
english language concern
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 130
fibonacci ten numbers 4 54
How do I remove an object from a 3 53
Eclipse Java import and method not resolved 4 82
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question