Solved

Help with Servlet

Posted on 2012-03-21
8
329 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
split string containing \r\n in Java 46 38
servlet requestdispatcher include and forward differences 1 24
ForLoop Example 3 40
javap bin 2 28
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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…

920 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

14 Experts available now in Live!

Get 1:1 Help Now