Convert XML Schema Files (XSD) in HTML Forms
Hi Everybody,
I am new in the topic of the XML, XSD, the situation is the following , I have a few files .XSD and need to generate automatic html forms based on these .XSD to gather information and later convert them into XML files and save them in a repository and later a middleware will process this information.
My first serious question if it is possible to develop the above mentioned task automatic? And the second one where you recommend to me to start investigating?.
Thanks in advance for your answer
Regards from Peru.
There are products which do that already, I think. XMLSpy is one. Check that out to see if I'm right (not sure about the HTML part). Otherwise, welcome to the club of several hundred people who have asked basically that same question (only not with the HTML part) here.
Similar Messages
-
Location of XML schema file (XSD)
Hi! Previously a XML schema was imported into the Console Manager and used for the import of data into the repository. Now we have made some changes and I would like to change the XML schema file. However, I would like to get a copy of the previously import schema (XSD) file from the system. Does anyone know where this file can possibly be held? Any way for us to extract this file to update?
Cheers!
SFHi SF,
the XSD is actually stored in MDM's database. One option to export is using the transport schema mechanism in MDM console - asuming that you're on MDM 7.1. If so, right-click on your repository in MDM console and choose Transport -> Export Repository Schema in the context menu. Doing this you'll get a huge XML file describing your repository. Open this XML in a suitable editor (e.g. IE, Wordpad, XML Spy, and so on) and check the file contents. Somewhere inside you'll find a section for XML Schemas and your XSD.
If you are on 5.5, the only option is accessing the DB directly...
Best regards
Michael -
Generating XSD files from an HTML form......
What is the best way to generate XML Schema files from an HTML form? Are there any APIs, Frameworks, software products, that already do this for you? What is the best way to do this programmatically?
I was thinking about using DOM...
Any help and/or advice will be greatly appreciated...
With thanks,
Unnsse Khanusers select what they want in their schemas
If the Schema info is added in a JSP.
Element Name: elementA
Data Type: string
Sub-Elements(Sequence): elementB, elementC
The field values may be retreived with with the getParameter method.
String elementName=request.getParameter("ElementName");
String type=request.getParameter("DataType");
From the values retreived a Schema may be constructed with the org.w3c.dom.* classes. -
XML Schema file in data definition
Hi,
I am creating a custom RTF template for a seeded data definition in the eBusiness Suite. The data definition has an XML Schema file loaded however this does not include all the data required for the template. Running the report to just generate the XML (i.e. no template) I can see that the additional data is available at this level just not included in the XSD.
I have built the template including the additional elements from the XML and expected to have to create a custom data definition as well to add the additional elements to the XSD. However the template is working against the seeded definition and successfully picking up the elements that are not included in the XSD.
Has anybody else come across this situation? And are there any potential issues? I could create a custom data definition as well to load an amended XSD but this would be a more invasive change as it would involve end dating the seeded data definition which I would prefer not to do. The report is not being generated from a concurrent request so I cannot just create a custom request and leave the seeded report untouched.
Thanks,
SarahThe XML Schema is only required if you are using a PDF template (the template file itself is PDF) with field-mapping. For other template types the schema is optional.
The XML Schema is used to define a "class" of XML documents, so to speak. The define the semantics and structure of the XML documents more thoroughly.
If you have closely related reports, you could use a single schema to standardize (in a sense) the XML to be output from the class of related reports. In that case you could have a single schema file uploaded to multiple reports/data-definitions.
The W3C has good documentation on XML Schema.
If you want to see samples, you can use tools such as dtd2xs to create sample schemas from your DTD. -
About the exporting and importing xml data file in the pdf form
Hi all,
I need help for importing xml data file in the pdf form. When I write some thing in the text field with fill color and typeface (font) and exported xml data using email button. When I imported that xml file in the same pdf file that is used for exporting the xml data then all the data are shown in the control but not color and font typeface. Anyone has suggestion for solving this problem. Please help me for solving this problem.
Thank you
Saroj NeupaneCan you post a sample form and data to [email protected] and I will have a look.
-
Dear Sun Developer Network,
I suppose maybe I should start at the beginning.
Can anyone outline the first few steps involved in parsing an XML schema file into a traversable data structure in Java?
I'd like to get a get a discussion started here about this, because I have some questions about the process as I currently understand it, and the more advanced (i'm supposing they're more advanced) questions that I've been asking in the past have gone completely unanswered in this forum. So perhaps, starting from the beginning, and working through to the difficulties I'm encountering would be a better approach to solving those issues.
Thank you,
Nels>
Many thanks for your reply! My next question is,
s, if parsing an XML schema file can be done with a
SAX or dom parser, then why has Sun bothered to
develop the JAXB api? What is the difference?
Hi Nels,
SAX and DOM are technologies for parsing and JAXB is a technology for databinding. They are 2 different technologies.
Parsing gives you acess to raw xml
DataBinding does the parsing and goes one step ahed and loads the data from xml to java objects. It is a higher level of abstraction over parsing
schema is a specification which helps to define the rules for a valid xml document. It also happens to be xml. DTD is a kind of limited schema which is non xml.
hope you got the diffrence.
ps: did you try the -J-Xmx switch with javac to resolve yhe OutOfMemory exception I suggested in your previous post
Regards,
Rajagopal -
Extending the Resource XML Schema XDBResource.xsd
Hi,
Is anybody could share an expirience about extending
the Resource XML Schema XDBResource.xsd ?
I want to use XML DB as document repository.
I want to use some application parameters (for
example document varchar id and so on) as resource
properties. I read from Oracle documentation, that
one way is to extend the Resource XML Schema XDBResource.xsd.
Users will put documents using WebDAV, so new schema
should be used default instead of XDBResource.xsd.
Is it possible ?
Thanks in advance
ViacheslavThos is an error in the documentation. Extending the Resource Schema is not currently supported. We are considering this for a future release of the product. XML DB does allow small amounts of user defined meta data to be added to a Resource.....
For Instance Given the following package
create or replace package xdb_namespaces
as
RESOURCE_NAMESPACE constant VARCHAR2(128) := 'http://xmlns.oracle.com/xdb/XDBResource.xsd';
METADATA_NAMESPACE constant VARCHAR2(128) := 'http://xmlns.oracle.com/xdb/userMetaData';
RESOURCE_PREFIX_R constant VARCHAR2(128) := 'xmlns:r="' || RESOURCE_NAMESPACE || '"';
METADATA_PREFIX_M constant VARCHAR2(128) := 'xmlns:m="' || METADATA_NAMESPACE || '"';
end;
select * from all_errors where owner = 'XDB'
create or replace public synonym XDB_NAMESPACES for XDB_NAMESPACES
grant execute on XDB_NAMESPACES to public
The following procedure can add metadata to the ANY defined by the current resource Schema
procedure addUserMetaDataNode(OID varchar2)
as
metadata_xml XMLTYPE := XMLTYPE('<m:UserMetaData ' || XDB_NAMESPACES.METADATA_PREFIX_M || '/>');
begin
update /*+ NO_TRIGGER */ XDB.XDB$RESOURCE r
set r.xmldata.RESEXTRA = metadata_xml.getClobVal()
where sys_nc_oid$ = hextoraw(OID)
and existsNode
object_value,
'/r:Resource/r:Contents',
XDB_NAMESPACES.RESOURCE_PREFIX_R
) = 1
and existsNode
object_value,
'/r:Resource/m:UserMetaData',
XDB_NAMESPACES.RESOURCE_PREFIX_R || ' ' || XDB_NAMESPACES.METADATA_PREFIX_M
) = 0;
end;
Note that this is not a SUPPORTED method of doing this.. Once the UserMetaDataNode has been added additional metadata can be added using updateXML with an XPATH that targets the UserMetaData node.
A Future release of XML DB will provide a facitlity to attach a row in a schema based XML table, containing user defined meta data to a resoure, in the same way that the defaultTable mechanisim allows the content of a resource to be stored in an XMLType table. -
Memory issue loading XML schema files
Hi,
I have an application that a startup reads available XML schema files from a folder and creates Validator objects that are put into a HashMap.
I'm running into problems creating validation schema objects when the file size of the schema is just over 30kB in size.
The following error message is given when testing with the "large" schemas:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.<init>(CMStateSet.java:100)
at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.firstPos(CMNode.java:96)
at com.sun.org.apache.xerces.internal.impl.xs.models.XSCMBinOp.calcFirstPos(XSCMBinOp.java:136)
at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.firstPos(CMNode.java:97)
at com.sun.org.apache.xerces.internal.impl.xs.XSComplexTypeDecl.getContentModel(XSComplexTypeDecl.java:185)
at com.sun.org.apache.xerces.internal.impl.xs.XSConstraints.fullSchemaChecking(XSConstraints.java:457)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:530)
at com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newSchema(SchemaFactoryImpl.java:206)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:489)
The smaller 1-10kB schemas can be stored without any problem regardless of the number I test (+1000).
The problem occurs as soon as it handles these larger schemas in the source directory. Even only one 30kB schema is enough to consume the all memory.
Below is the code uesd for creating the validation objects
for(int i=0;i<files.length;i++){
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(files);
schema = factory.newSchema(schemaFile); // Here is where the process fails
Validator validator = schema.newValidator();
hm.put(documentType, validator); //hm is the HashMap used as placeholder for Validator objects
Regards,
Håkan
Edited by: dezer on Jun 2, 2010 5:04 AM
Edited by: dezer on Jun 2, 2010 5:08 AMWelcome to the Sun forums.
dezer wrote:
..Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
The smaller 1-10kB schemas can be stored without any problem regardless of the number I test (+1000).
The problem occurs as soon as it handles these larger schemas in the source directory. Even only one 30kB schema is enough to consume the all memory.Are you certain that only one schema is involved? How does the code tell how many schemas there are?
Below is the code uesd for creating the validation objects
for(int i=0;i<files.length;i++){
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(files);
schema = factory.newSchema(schemaFile); // Here is where the process fails
Validator validator = schema.newValidator();
hm.put(documentType, validator); //hm is the HashMap used as placeholder for Validator objects
It would seem that if files.length is 10000, that would end up in around 30 times as much memory usage as for the 1000x10Kb schemas. -
Hi all,
I just read Pages 346-348 of the book "Microsoft SQL Server 2012 Bible" written by A. Jorgensen, P. LeBlanc, J. Chinchilla, J. Segarra & A. Nelson (published by Wiley) regarding XML Schemas and XML SCHEMA COLLECTIONS: Step 1. create and
save orderxml.xml
<Order OrderID="1">
<Item>
<ItemNumber>V001</ItemNumber>
<Quantity>1</Quantity>
<Price>299.99</Price>
</Item>
</Order>
Step 2. using the tool in the following location:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
Open a command prompt, and navigate the preceding directory. The syntax for creating schema is: Xsd.exe C:\temp\orderxml.xml /outputdirectory:c:\temp to create the orderxml.xsd file.
Step 3. Copy all the contents of the orderxml.xsd file to the clipboard, and create a new query window in SQL Server Management Studio, pasting in the content of the clipboard. To create the XML Schema Collection, you need to add the CREATE XML SCHEMA COLLECTION
statement to the beginning of the schema as shown below:
--MSss2012bibleP348.sql for XML Schema Collection OrderInformationSchemaCollection
-- Copied and executed by SHC (Date & Time): 24 April 2015 8:05 AM
USE ScottChangDB
GO
Create XML SCHEMA COLLECTION OrderInformationCollection AS
N'<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schema-microsoft-com:xml-msdata">
<xs:element name="Order">
<xs:sequence>
<xs:element name="Item" minOccurs="0" maxOccurs="unbounded".
<xs:complexType>
<xs:sequence>
<xs:element name="ItemNumber" type="xs:string" minOccurs="0" />
<xs:element name="Quantity" type="xs:string" minOccurs="0" />
<xs:element name="price" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="OrderID" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded'>
<xs:element ref="Order" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>' ;
/* Apply it to the table/columns */
ALTER TABLE ItemInfo
ALTER COLUMN ItemData xml (OrderInformationCollection)
GO
I prepared (i) the orderxml.xml file for Step 1 and Step 2, and (ii) the MSss2012bibleP348.sql file for Step 3. But I am not sure that I can do the Steps (i) and (ii) in my PC that does not have the regular version of Microsoft SQL Server 2012 and Microsoft
Visual Studio 2012. Furthermore, I have difficulties to do Step 2 and Step 3 in my PC that is the part of Windows 7 Lan Computer System in my office: I navigated to my C:\Program Files (x86)\Microsoft SDKs\v7.0A\Bin\, I did not see the x64
thing in the Bin folder, but, I saw the xsd.exe in the Bin folder. If I click the xsd.exe and I get the following in the bottom of the PC screen:
xsd.exe Date modified:12/122011 12:55 PM Date created: 12/12/2011 12:55 PM
Applicaion Size:81.8 KB
Also, I see my PC screen flashes (and it looks like a dialog box with black background to flash for me to type the command) quickly. I am lost completely in this step and I don't understand the whole thing in doing Step 1, Step 2, and Step 3
I briefly summarized/described/presented above.
I need the following help from the experts of XML Schemas and XML Schema Collections in Microsoft SQL Server 2012 Management Studio:
Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
Help #2: How can I execute the xsd.exe in my C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in my ScottChangDB
database?
Please kindly help and give me the answers/comments for Help #1, Help #2 and Help #3.
Thanks in advance,
Scott ChangHi Scott,
Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
Step1 and Step2 not that related to SQL Server, you can get the XSD from a given XML with an online XSD generator.
Google search: XSD generator
Help #2: How can I execute the xsd.exe in my C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
Please see the link in the #1
Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in
my ScottChangDB database?
See the syntax and example in
create XML schema collection
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
How to upload a file with a HTML form into a BLOB ?
Hi,
I want to upload a file into a BLOB.
I have created a procedure in PL/SQL whitch generates an html form.
You can upload a file with <input type="file" name="my_file">.
How can I insert this file into my database ?
Thank's for your Help
EstelleHi Estelle,
Portal Applications forum is a more apporpriate forum for such questions. Please post your question there.
Thanks,
Ravi -
Urgent :post xml for xsql difference with html form post
Hi,
We are developing an application to process xml request
posted by external party. The requests arrive by
http-post operation
We developed and tested with an html-form.
Now we encounter problems in testing with http-post
The xsql page is processed correctly but
insert only fixed text when formatting xml-data as input for
the insert-request, string inserted is empty.
Everything is by the book and html-forms works great.
Is anybody else using xsql to insert xml data in the database on this version? Maybe can you help by looking into a testcase ? Issued a tar but am on terrible deadline
so need help very soon.
Details: HP-UX 11.11 Oracle 9.2.0.4 java1.4 ojdbc 1.4
Tnx in advance,
JeroenMark,
Have an external partner which sends xml-requests.
Have to read those, store them and process them.
Idea is let them
1)post the xml at a url where an xsql page is reading the xml
2) transforming this for an insert into
the database. The column is defined to store the complete xml-message.
3) A trigger takes care of processing the stuff and preparing the output
4) and a query in the xsql-page reads the output from an output table
When developing and testing this with an html-form that posts the xml is works great.
$ cat newclobins.xsql
<?xml version="1.0"?>
<page connection="demo" xmlns:xsql="urn:oracle-xsql" >
<xsql:set-session-param name="id">
select msgid.nextval from dual
</xsql:set-session-param>
<xsql:dml>
delete cbs_msg_in where id={@id}
</xsql:dml>
<xsql:insert-request table="cbs_msg_in" column="id,msg" transform="cbsform_1.xsl"/>
<data>
<xsql:query null-indicator="yes">
select msgid,msg from cbs_xml_out where msgid={@id}
</xsql:query>
</data>
</page>
$ cat cbsform_1.xsl
<?xml version="1.0"?>
<ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">
<xsl:for-each select="request">
<ROW>
<MSG><xsl:value-of select="parameters/doc" /></MSG>
<ID><xsl:value-of select="session/id" /></ID>
</ROW>
</xsl:for-each>
</ROWSET>
1) When using a tool like
http://www.programmersheaven.com/articles/adrian/getpost/article.html it fails with
No rows to modify -- the row enclosing tag missing. Specify the correct row enclosing tag.
2) When using the commandline utility like
xsql jeroen5.xsql posted-xml=test3.xml
this works great when inserting plain text but not
when inserting xml-format data into a column
So problem 1 is why external tools like above or my partner that uses .net to do something similar gives this strange error?
Problem nr 2 is should I stick to just the data in xml and forget about storing the xml-formatted data?
Hope you can help because I am getting quite desparate here.
Regards,
Jeroen -
Reading html data & uploading a file in single html form using htp package
Hi
I have designed a html screen using htp package in which i have few text items and file upload button. I have to validate all forms data like text items and check box elements and upload file to unix. I am using java script for file validations and cgi script to upload file. With this I am able to either read form data or upload file but not both.
At a time I want to insert a record to database with html form values and upload file to unix with htp package. Please suggest how can I read html form data + uploading a file to unix simultaneously in a single htp procedure.
Thanks,
PradeepHave you ever considered using Application Express (APEX)?
Oracle Application Express (APEX)
Sounds like you're going the long way around to create a web based application. -
Converting XML Document Message (xsd string) to BPEL
Hello, I have written a BPEL flow that takes input from a client (a query) then Invokes a scynchronous data service (passes some parameters to run a federated query) that returns an xsd string that is a set of records in XML (see below). I want to understand how I use the Assign function (or other method) to consume the xsd string (XML file) in BPEL.
I set up complexType elements in the WSDL schema as follows (snippet, not complete WSDL) to manage the input and output:
<element name="QueryRequest" type="tns:inputType"/>
<element name="QueryResult" type="tns:recordType"/>
<complexType name="inputType">
<sequence>
<element name="username" type="string"/>
<element name="password" type="string"/>
<element name="city" type="string"/>
<element name="state" type="string"/>
<element name="zip" type="string"/>
</sequence>
</complexType>
<complexType name="recordType">
<sequence>
<element name="customer" type="tns:customerType" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="customerType">
<sequence>
<element name="accountNumber" type="string"/>
<element name="lastName" type="string"/>
<element name="firstName" type="string"/>
<element name="email" type="string"/>
<element name="city" type="string"/>
<element name="state" type="string"/>
<element name="zip" type="string"/>
</sequence>
</complexType>
Information:
- BPEL PM 2.1.2
- BPEL Designer Eclipse Plugin 0.9.10
<?xml version="1.0" encoding="ISO-8859-1"?>
<recordset>
<customer>
<CustNum>1</CustNum>
<CustLName>aLName</CustLName>
<CustFname>aFName</CustFname>
<CustAddress>111 a street</CustAddress>
<CustCity>austin</CustCity>
<CustState>TX</CustState>
<CustZip>78000</CustZip>
</customer>
<customer>
<CustNum>2</CustNum>
<CustLName>bLName</CustLName>
<CustFname>bFName</CustFname>
<CustAddress>112 b street</CustAddress>
<CustCity>austin</CustCity>
<CustState>TX</CustState>
<CustZip>78000</CustZip>
</customer>
<customer>
<CustNum>5</CustNum>
<CustLName>eLName</CustLName>
<CustFname>eFName</CustFname>
<CustAddress>115 e street</CustAddress>
<CustCity>austin</CustCity>
<CustState>TX</CustState>
<CustZip>78002</CustZip>
</customer>
<customer>
<CustNum>6</CustNum>
<CustLName>fLName</CustLName>
<CustFname>fFName</CustFname>
<CustAddress>116 f street</CustAddress>
<CustCity>austin</CustCity>
<CustState>TX</CustState>
<CustZip>78002</CustZip>
</customer>
<customer>
<CustNum>BOBA101</CustNum>
<CustLName>Austin</CustLName>
<CustFname>Bob</CustFname>
<CustAddress>101 Main Street</CustAddress>
<CustCity>Austin</CustCity>
<CustState>TX</CustState>
<CustZip>78112</CustZip>
</customer>
<customer>
<CustNum>JOHNA103</CustNum>
<CustLName>Austin</CustLName>
<CustFname>John</CustFname>
<CustAddress>112 Main</CustAddress>
<CustCity>austin</CustCity>
<CustState>tx</CustState>
<CustZip>78113</CustZip>
</customer>
</recordset>
Any and all help is greatly appreciated.Hi Sean,
Can you forward your Project files to us by zipping it and renaming the .zip to .zap and send it to [email protected] with the same subject as this thread?
Regards,
Dhaval -
How can i convert my encrypting file to a applet form to use it in IE?
Hi, i m a little new in JAVA.
I searched about encryting methods. And i decide to built a encrypter that reads a string from a textbox and writes the encrypted form to another textbox.. this code is working in eclipse. but i cannot convert this to applet form to use it in internet explorer .. i dont know why this not work. It says : "Applet password notinited" -> How can i solve this problem ???
Please HELP ME ! Thanks alot..
package yeni;
import java.applet.*;
import java.awt.*;
import java.lang.*;
import java.net.*;
import java.io.*;
import java.util.*;
import javax.crypto.*;
import javax.crypto.spec.*;
public class password extends java.applet.Applet
SecretKeySpec keyS;
SecretKey key;
SecretKey key_s;
String encrypted;
String decrypted;
KeyGenerator keyGen;
Mac mac;
byte[] utf8;
byte[] digest;
private Button b_open;
private Button b_next;
private TextField t_userID;
private TextField t_password;
private TextField re_userID;
private TextField re_password;
private Label l_title;
private String root;
private int col;
private String title;
private String buttontxt;
private int bgcolor;
private int fsize;
private String fface;
private String errorURL;
/* Init */
public void init()
String att = getParameter("root");
root = (att == null) ? this.getDocumentBase().toString() : att;
att = getParameter("textfield");
col = (att == null) ? 20 : (Integer.valueOf(att).intValue());
att = getParameter("font_size");
fsize = (att == null) ? 11 : (Integer.valueOf(att).intValue());
att = getParameter("font_face");
fface = (att == null) ? "Arial" : att;
att = getParameter("color");
bgcolor = (att == null) ? Color.white.getRGB() : (Integer.parseInt(att, 16));
att = getParameter("title");
title = (att == null) ? "" : att;
att = getParameter("button");
buttontxt = (att == null) ? "OPEN" : att;
att = getParameter("wrong");
errorURL = (att == null) ? "" : att;
setFont(new Font(fface, Font.PLAIN, fsize));
setBackground(new Color(bgcolor));
b_open = new Button(buttontxt);
b_next = new Button("NEXT");
t_userID = new TextField(col);
t_password = new TextField(col);
re_userID = new TextField(col);
re_password = new TextField(col);
l_title = new Label(title);
t_userID.setBackground(Color.white);
t_password.setBackground(Color.white);
t_password.setEchoCharacter('*');
re_userID.setBackground(Color.YELLOW);
re_password.setBackground(Color.YELLOW);
// re_password.setEchoCharacter('-');
setLayout(new FlowLayout(FlowLayout.CENTER,3,3));
if(title.length()>0)
add(l_title);
add(t_userID);
add(t_password);
add(b_next);
add(b_open);
add(re_userID);
add(re_password);
t_userID.setText("User ID");
t_password.setText("Password");
//re_password.hide();
//re_password.hide();
show();
/* Transfer - �ifreleleme */
void transfer()
if(t_userID.getText().length()>0)
re_userID.setText(t_userID.getText());
else t_userID.setText("Enter Your USER ID!");
if(t_password.getText().length()>0)
//Calling HMAC Function
re_password.setText(HMAC(t_password.getText()));
/* HMAC Fonksiyonu - �ifreleme */
public String HMAC(String values){
String output = "";
try {
//Generate a key for the HMAC-MD5 keyed-hashing algorithm;
key = new SecretKeySpec( "istenen anahtar".getBytes("ASCII"), "HmacMD5");
// Create a MAC object using HMAC-MD5 and initialize with key
mac = Mac.getInstance("HmacMD5");
mac.init(key);
// Encode the string into bytes using utf-8 and digest it
utf8 = values.getBytes("UTF8");
digest = mac.doFinal(utf8);
//If desired, convert the digest into a string
String digestB64 = new sun.misc.BASE64Encoder().encode(digest);
output += digestB64;
catch(Exception e){}
return output;
/* surfto_error Fonksiyonu - Hata durumu */
void surfto_error()
if(errorURL.length()>0)
try
getAppletContext().showDocument(new URL(errorURL),"_self");
catch (MalformedURLException e) {}
else
re_password.setText("");
showStatus("Invalid password!");
/* surfto Fonksiyonu - Bilgi Aktar�m� */
void surfto()
if(t_password.getText().length()>0)
try
URL surftoURL = new URL(root+t_password.getText()+".html");
InputStream in = surftoURL.openStream();
in.close();
getAppletContext().showDocument(surftoURL,"_self");
catch (MalformedURLException e) { surfto_error(); }
catch (SecurityException e) { surfto_error(); }
catch (IOException e) { surfto_error(); }
/* Durum ��leme */
public boolean handleEvent(Event evt)
if(evt.id == Event.KEY_PRESS && evt.target == t_password && evt.key==10)
surfto();
return(true);
return super.handleEvent(evt);
/* Eylem ��leme */
public boolean action(Event evt, Object arg)
if (evt.target == b_open)
surfto();
return true;
if (evt.target == b_next)
transfer();
return true;
return(super.action(evt,arg));
}In method HMAC, you have towards the bottom
catch(Exception e) {}please change this to
catch(Exception e)
e.printStackTrace();
}Note that using the sun.* classes, including the sun.misc.BASE64Encoder class, requires elevated privileges (see http://forum.java.sun.com/thread.jspa?threadID=483223&messageID=2255882).
It is not difficult to write your own encoder/decoder class, or borrow one from someone else. Just google on "java base64 encoder". -
How to get the upload file from a html form ?
I have a <input type=file ...> control in my form, and the user use that
control to submit a file
to my web server. The porblem is the getParameter() function of
HttpServletRequest only return the
filename. Does anyone know how to get the file body ?
Frances
http://www.servlets.com/jsp/examples/ch04/index.html#ex04_17
Frances Fan <[email protected]> wrote:
> I have a <input type=file ...> control in my form, and the user use that
> control to submit a file
> to my web server. The porblem is the getParameter() function of
> HttpServletRequest only return the
> filename. Does anyone know how to get the file body ?
> Frances
Dimitri
Maybe you are looking for
-
On some sites (e.g. http://www.bbc.co.uk/news/, http://www.cambridge-news.co.uk/Home/) text, especially headings, that used to be in roman style is now oblique/italic, and harder to read.
-
Hi I need a solution to print the cheque directly to the printer(exclusively used for printing Cheque printer name HPLASER) from R12, As of know once the conc program Format Payment Instructions is completed normal, I click the view button to view th
-
How to transport deletion config entry
Hi I have deleted payment terms in Development client and want to reflect the same in Quality.It did not ask for Transport request while deleting.I am aware in case of any addtion or modifications we select the particular new/modified entry and creat
-
Poor Customer Experience - How to Report It?
Ive spent the better part of the last hour trying to understand how to connect with someone who will discuss my Apple customer experience with me. Everything is organized by product and technical or functional issue. I cant seem to talk to someone ab
-
Getting rid of or changing music
I am new to mac and would like to know how to either get rid of the background music while viewing photos in Front Row or at least changing it. I am sure it's an easy answer, but I have no clue. Thanks for any help.