Solved

Help with Servlet

Posted on 2012-03-21
8
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

707 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