Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

How do I get a file from HTML page in CICS 4.2 by jcics?

270007RMD5 gravatar image
Question by morteza_pashaki  (1) | Apr 10, 2015 at 09:31 AM cicscicstsjavajcics

I want to get a image file from web (html page) in CICS 4.2 and JAVA(jcics). The file send by input file element in html ,but in my application i can't get it and get name of file only. i use jcics in cics 4.2.

html page :

 <form name="fileform" method="post" action="/CICS/CWBA/tlc" enctype="multipart/form-data" >
         <label for="ex6">Get picture</label>
         <input type="file" id="exa" name="pic" accept="image/*"  > 
         <input type="submit" id="save" value="save"  />
          </form> 

in server side program :

 customer.setPic( request.getFormFieldData("pic"));

People who like this

  0
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

1 reply

  • Sort: 
060001HHD1 gravatar image
Accepted answer

Answer by MarkPocock (731) | May 21, 2015 at 03:41 AM

What you are trying to do should work exactly as you have described it.

I tried the same thing on my CICS TS 4.2 system and it worked as expected.

I used this simple piece of HTML:

 <form method="POST" action="http://host:port/javaform" enctype="multipart/form-data">
 <input type="file" id="exa" name="infile" accept="image/*"  >
 <input type="submit" name="Test" value="Test">
 </form>

In CICS this drove the following java program which reads the formfield value and returns the input image file back to the browser;

     public static void main(String[] args) {
         Task t = Task.getTask();
         if ( t == null )
             System.err.println("CICSWeb: Can't get Task");
         else
         {
             try
             {
             System.out.println("CICSWeb: Started");
             HttpRequest request = HttpRequest.getHttpRequestInstance();
             byte[] infile = request.getFormFieldData("infile");
             System.out.println("CICSWeb: input file field length is " + infile.length);
             
             System.out.println("CICSWeb: generating response");
             HttpResponse response = new HttpResponse();
             response.setMediaType("image/jpg");
             response.setNoServerConvert();
             response.sendFrom(infile);
             
             System.out.println("CICSWeb: Completed");
             }
             catch (Exception e)
             {
                 e.printStackTrace();
                 System.out.println("CICSWeb: Unexpected exception " + e.getMessage());
             }
         }
     }
 

If this is still failing for you then you could try an EXEC CICS WEB RECEIVE to get all the data CICS has received into your application. That would show if the right data has been sent in. You could also use CEDF to debug each JCICS command. A CICS trace would also show what is going on (you would need SO and WB trace components set to 1-2 and others at 1).

Comment
Theresa Hamilton
Shayla_Robinson

People who like this

  2   Show 1   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
2700053X08 gravatar image W3TTT (1)   Jul 05, 2018 at 10:31 AM 0
Share

"I want to get a image file from web (html page) in CICS 4.2 and JAVA(jcics)..."

I seem to not understand what is being requested, exactly. Is this image file existing on the z/OS mainframe? What does morteza_pashaki mean by "from web"?

Also, what are the imports? Please include any library imports when you provide sample code.

Follow this question

26 people are following this question.

Answers

Answers & comments

Related questions

Are the JCICS classes threadsafe? 1 Answer

Connecting to IBM DB2 via CICS TS 5.1 using Liberty 8.5.5 web application (JDBC type 2) 1 Answer

DFHSJ0215 and DFHSJ0914 when trying to start my OSGI JVM Server in CICS TS 5.1 1 Answer

Java output files changed after upgrade to CICS TS 5.3 1 Answer

CICS Liberty fails to connect to the Angel with CWWKB0101I after upgrade to z/OS 2.2 RSU1803 or z/OS 2.3 1 Answer

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges