Solved

Help with Servlet

Posted on 2012-03-21
8
328 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&amp;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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now