Reusable JSF components - bundling a converter with a text field
I am trying to create reusable text fields for different types of data (notes, amounts, percentages) that will use a JSF converter to implement formatting.
Here is what I have done
- created an application in JDeveloper that contains my components as JSF declarative components
- created the Converter classes
- registered the converter classes in faces-config.xml of the reusable components project
- added my Converters to the inputText fields for each of my declarative components using the property palette
- deployed the components as a jar file using the ADF Library Jar File archive type
- created a second application to act as a consumer of the components
- imported the jar file into the component palette using a file system connection
- added the jar file to the active project's component library
- added a converter entry for the converter I am trying to use to this project's faces-config.xml
- created a consumer jspx page and dragged and dropped the control onto the page
I put some system.outs in the getAsString() and getAsObject() methods of the converter I am trying to use and they are not output when I run the page. I've also set breakpoints in those methods to see if they are being called.
I have no indication that my converter is being called.
Can someone please confirm that what I am trying to do is possible using the declarative components?
Any insight appreciated.
Dave
Actually this is working. I made the incorrect assumption that getAsString() in the converter class would be called on the initial request.
Another thing I just noticed is that it is not necessary to reference the converter in the faces-config.xml of the consuming project. Not sure how this works, but its a nice feature :)
Similar Messages
-
Create reusable jsf components as jsf components
Hi
I'm new to JSF (and J2EE in general, I used to use WebObjects a decade ago). I'm using JSF 1.2
so, I'd like to know if it is possible to create reusable jsf components designing some jsp page ?
I'm particularly interressed in reusable components that, when used, are not leafs in the html trees (but so support that the reusing page provide some piece of html to be put "inside")
Is there any way to do that ? (WebObjects, a decade or so ago, allowed to do that...)
Thanks for your help
cdUse Facelets instead of JSP. Then you can make use of ui:composition for this.
By the way, J2EE is dead, it's called Java EE now. This keyword must give you more r|decent Google results. -
Is there a way to print the check register with the Text field
Hi,
Is there a way to print the check register with the Text field and also each item's Text field?"
When we enter a invoice we enter a generic text on the Basic Data tab then enter a "+" on each individual line item which in turns defaults to the generic text. Just wanted to know if the check register could draw in the individual line item detail where we can enter text that relates to just that line item. Sort of like the MIR7 draws in the detail for each item.
Kindly help me in full fill the above requirement.
Thanks
SunithaHi,
Can any one help me on this issue?
Thanks
Sunitha -
Paging a data table with input text fields
I've created a datatable with input text fields so that contents can be edited. I have 'save' and 'cancel' buttons on the page so that changes can be saved or abandoned. That seems to work fine.
However, I have a problem with paging. If I modify an input text field, page to the next page in the datatable and then page back, the modified input text field reverts to the original entry in the database. Does anyone know how I can preserve this change (without issuing a commit) until the user clicks on the save button?
Here is a snippet of jsp with datatable.
<h:dataTable binding="#{DocTypeDetail.doctypeMetadataTable}" headerClass="list-header" id="doctypeMetadataTable"
rowClasses="list-row-even,list-row-odd" rows="5" style="left: 240px; top: 312px; position: absolute"
value="#{DocTypeDetail.doctypeMetadataTableModel}" var="currentRow">
<h:column binding="#{DocTypeDetail.column2}" id="column2">
<h:inputText binding="#{DocTypeDetail.textField1}" id="textField1" value="#{currentRow['name']}"/>
<f:facet name="header">
<h:outputText binding="#{DocTypeDetail.outputText5}" id="outputText5" value="Name"/>
</f:facet>
</h:column>
<h:column binding="#{DocTypeDetail.column3}" id="column3">
<h:inputText binding="#{DocTypeDetail.textField2}" id="textField2" value="#{currentRow['value']}"/>
<f:facet name="header">
<h:outputText binding="#{DocTypeDetail.outputText8}" id="outputText8" value="Value"/>
</f:facet>
</h:column>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header"/>
<f:facet name="header">
<h:panelGroup binding="#{DocTypeDetail.groupPanel1}" id="groupPanel1" style="display: block; text-align: center" styleClass="list-paging-header">
<h:commandButton action="#{DocTypeDetail.doctypeMetadataTable_firstPageAction}"
binding="#{DocTypeDetail.doctypeMetadataTableHeaderFirstButton}" id="doctypeMetadataTableHeaderFirstButton"
image="resources/paging_first.gif" immediate="true"/>
<h:commandButton action="#{DocTypeDetail.doctypeMetadataTable_previousPageAction}"
binding="#{DocTypeDetail.doctypeMetadataTableHeaderPreviousButton}" id="doctypeMetadataTableHeaderPreviousButton"
image="resources/paging_previous.gif" immediate="true"/>
<h:commandButton action="#{DocTypeDetail.doctypeMetadataTable_nextPageAction}"
binding="#{DocTypeDetail.doctypeMetadataTableHeaderNextButton}" id="doctypeMetadataTableHeaderNextButton"
image="resources/paging_next.gif" immediate="true"/>
<h:commandButton action="#{DocTypeDetail.doctypeMetadataTable_lastPageAction}"
binding="#{DocTypeDetail.doctypeMetadataTableHeaderLastButton}" id="doctypeMetadataTableHeaderLastButton"
image="resources/paging_last.gif" immediate="true"/>
</h:panelGroup>
</f:facet>
</h:dataTable>I know by now you must have figured it out. If not you might want to try keeping the backing bean in session instead of request scope.
Hope that helps,
HeMan -
Linking a select field with a text field in a DW form.....
I did try to search for this but nothing came to my attention. Apologies if it is already in the forum.
Is it possible to have a "select field" link with a "text field"? In other words The select field will provide different venues to choose from, in this case "Blog, Trade Show, Friend, Photo Magazine" and then after the choice is made a text field appears that allows you to provide details re. your choice. For example if you choose "Trade Show" from the select field the text field will then appear and prompt you to detail WHICH Trade Show. Something along those lines. Any assistance will, as always, be appreciated.
-G-You need scripts for this. Try this jQuery tutorial
http://anthonygthomas.com/2010/03/14/display-form-fields-based-on-selection-using-jquery/
Nancy O. -
Hi,
Is it possible on iPhone to create an alert with a text field?
Thanks,
NavaYou can subclass the alert and hack around with it, but in my experience, it would be easier to just write the functionality rather than trying to reuse the alert, but fighting it's built-in functionality.
-
Earliest Adobe Reader Version with Editable Text Field Functionality
Hi all,
Can someone inform me of the earliest version of Adobe Reader with which you can edit a document with editable text fields? I've designed a form using LiveCycle and, prior to distributing it to customers, would like to determine the minimum spec for Reader.
Thanks, JBEditable fields came in with 3.0, but if you use LiveCycle Designer,
which is new technology, it's 7.0 or so.
Aandi Inston -
Form Size with one text field 442kb
I started work on a new version of a three page dynamic form because the old version was 1,537kb.
After setting up my new blank master pages (3), I placed a text field on the blank "cover page". The from size went from 12kb to 442kb with one text field. How can one small text field with no caption increase the file size so tremondously. That's a factor of 36! Any suggestions? I am using:
Microsoft Windows 7
Adobe Acrobat Pro X 10.1.6
Livecycle Designer ES2 Version 9.0
FYI: I have read that there exists some tools out there to inspect your pdf/xml and see what objects are increasing your file size. This would be very helpful, however I work for a company that gives very little freedom in downloading unapproved software. So unless there is an Adobe way to inspect for an object and its impact on size, I am in a tough situation. Thank you for your time.
https://workspaces.acrobat.com/?d=H06NjDMAiTS79khuQCoKKwRemove the embed fonts feature to reduce your file size:
File > Form Properties > Save Options
Old version file size went from 1,537kb down to 132kb -
Error converting SQL Server text field to Oracle CLOB
I am trying to convert an SQL Server DB to Oracle DB using DB link. The issue I am facing is one of the SQL Server table contains text field and we are trying to convert the text field to CLOB.
The error I am getting is "SQL Error: ORA-00997: illegal use of LONG datatype"
The statement is something like this.
Insert into oracle_table
Select col_1,col_2,col_3,col_4,col_5 from sql_table@sqldblink;
Please help.Hi,
This is a known restriction involving long columns -
(1) LONG datatype not supported with use of DBLINK when insert or update involves a select statement
(2) LONG datatype cannot be used in a WHERE clause, in INSERT into ... SELECT ... FROM
constructs, and in snapshots.
The workround is to use a PL/SQL procedure or try the SQLPLUS COPY command.
If you have access to My Oracle Support then review these notes -
Cannot Move A Long From non Oracle database Ora-00997: Illegal Use Of Long Datatype (Doc ID 1246594.1)
How To Workaround Error: Ora-00997: Illegal Use Of Long Datatype (Doc ID 361716.1)
Regards,
Mike -
How to create a pdf/a-1b with a text field
hello, I'm trying to execute a very simple task: create a pdf/a-1b containig a text field.
using Acrobat XI pro, I created a simple pdf form with 1 form field of type text , then tried to save as pdf/A-1b. The pdf is saved but the form field is removed from resulting pdf.
Here in detail the steps I made:
0) configure adobe pdf printer to save as pdf/A-1b
1) creat a test.txt with notepad
2) print using acrobat pdf printer
3) open the generated pdf with Acrobat XI
4) in 'Standards' panel I see that pdf conform
5) now go to 'Tools\Modules' and 'Modify'
6) add a textbox field
7) exit from 'Modify' mode and save
8) in 'Standards' panel I see that pdf doesn't conform.
9) I opened the preflight tool and see two errors
a) "XMP property for a page object not predefined and no extension schema present".
page reports the following Trigger values:
- Extension schema is present in XMP: is not true
- Property exists in PDF/A Standard: is not true
b) Form field does not have an appearance dictionary
page reports the following Trigger values:
- Form field has an appearance dictionary: is not true
I'm quite new to Acrobat: simply downloaded the Actobat XI evaluation version, created the file and added the text field. No special settings nor other configurations was applied,
I'm wondering if someone else was able to reproduce this behavior.
thank you for any commentFirst, about invalidating the PDF/A. I was told, but never had this confirmed nor tested, that editing a PDF/A will automatically cause the PDF/A status to be deleted from the file. This is because Acrobat does not know about the compatibility of every edit with every current (and future) PDF subset standard, so it is safest just to remove the indicator - if you turn off Adobe's PDF/A view mode which will prevent editing anyway.
Now, you have a problem with the signatures. Possibly a very big one. Your description "2) fill the text field with some annotations and then sign the signature field 3) save the pdf" is a little too separated. At the time a file is signed it is saved, the hash calculated, and written to the file. So signing and saving are just one action. Yet an unsigned digital signature needs, it seems to me, no appearance.
I think the solution is a simple one. Sign it, but not with a signature field. If it is PDF/A when you start it is probably PDF/A when you finish. Signature fields seem a distraction and obstacle to the important thing, signing. -
Trying to create a template with adjustable text fields.
I need to creat a form or template with adjustable text and image fields. I need to have a background template for multiple pages that when I make a change to the template it make the changes to all pages, like the master page of indesign. I also need to have text and image fields that are specific to each page but the dimensions and placement are controled by the template,but the information inside is page spacific. What program should I use and anyone know a tutorial for help?
What you want would require elaborate programming or dealing with variables in Framemaker or InDesign (Server) to dynamically generate the output upon request. You can of course get part of the features using normal variables in ID e.g. to pull linked images based on some parameters, but generally your request sounds too complex to deal with all scenarios.
Mylenium -
Hi,
I want to load a string of characters to a text field of a table. I'm using SQL Loader.
I've tried to declare the field in several types: varchar2(4000), clob, raw, etc, but when I run sql loader to load the text I get the same error: The data file exceeds maximum lenght. I've tried with a shorter text and it works.
My question is, why I can't load long characters in that field?
Thanks in advance.
Regards.Although you have made your table column up to size 4000, SQLLoader have not got a clue about that. You still need to tell SQLLoader that the text coming in is more than the default 255 in your control file. Strange isn't it?
Here is my table named testlog. Note that I changed the column names LOG, DAY, TIME and TYPE because they are reserved Words
SQL> CREATE TABLE TESTLOG
2 (LOG_1 CHAR(3) NOT NULL,
3 DAY_1 DATE,
4 TIME_1 CHAR(8),
5 SOURCE VARCHAR2(100),
6 EVENTID NUMBER(22),
7 TYPE_1 VARCHAR2(64),
8 CATEGORY VARCHAR2(64),
9 USER0 VARCHAR2(64),
10 COMPUTER VARCHAR2(64),
11 MESSAGE VARCHAR2(4000) NOT NULL)
12 /
Table created.
SQL> desc testlog
Name Null? Type
LOG_1 NOT NULL CHAR(3)
DAY_1 DATE
TIME_1 CHAR(8)
SOURCE VARCHAR2(100)
EVENTID NUMBER(22)
TYPE_1 VARCHAR2(64)
CATEGORY VARCHAR2(64)
USER0 VARCHAR2(64)
COMPUTER VARCHAR2(64)
MESSAGE NOT NULL VARCHAR2(4000)
SQL> select * from testlog;
no rows selected
SQL>
I saved the same data you have abvoe in a file named testlog.txt Here is my test controlfile named testlog.ctl
LOAD DATA
INFILE 'testlog.txt'
INTO TABLE testlog
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
LOG_1 CHAR NULLIF (LOG_1=BLANKS)
, DAY_1 DATE "DD/MM/YYYY" NULLIF (DAY_1=BLANKS)
, TIME_1 CHAR NULLIF (TIME_1=BLANKS)
, SOURCE CHAR NULLIF (SOURCE=BLANKS)
, EVENTID INTEGER EXTERNAL NULLIF (EVENTID=BLANKS)
, TYPE_1 CHAR NULLIF (TYPE_1=BLANKS)
, CATEGORY CHAR NULLIF (CATEGORY=BLANKS)
, USER0 CHAR NULLIF (USER0=BLANKS)
, COMPUTER CHAR NULLIF (COMPUTER=BLANKS)
, MESSAGE CHAR(4000) NULLIF (MESSAGE=BLANKS)
Here is the Result of my test run
D:\DBMSDIRECT\DBA\Test>sqlldr userid=test control=testlog.ctl
Password:
SQL*Loader: Release 11.1.0.6.0 - Production on Fri Nov 5 15:36:05 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Commit point reached - logical record count 1
D:\DBMSDIRECT\DBA\Test>
Here is the Result in the table
SQL> col message format a50
SQL> col source format a50
SQL> col category format a10
SQL> col source format a10
SQL> col user0 format a10
SQL> col type_1 format a10
SQL> col computer format a10
SQL> set pasge 20
SQL> select * from testlog;
LOG DAY_1 TIME_1 SOURCE EVENTID TYPE_1 CATEGORY USER0 COMPUTER MESSAGE
SEC 04-NOV-10 12:26:02 Microsoft- 4656 Success 12800 server1.it A handle to an object was requested.^`^`Subject:^`
Windows-Se acasa-sa.c Security ID: S-1-5-21-3830471607-3036766313-42914
curity-Aud om 15205-2156^` Account Name: mbelles^` Account Domai
iting n: ITACASA-SA^` Logon ID: 0x38988bbc^`^`Object:^`
Object Server: Security^` Object Type: File^` Obje
ct Name: K:\AMBIENTE^` Handle ID: 0x1e18^`^`Proces
s Information:^` Process ID: 0x4^` Process Name: ^
`^`Access Request Information:^` Transaction ID: {
00000000-0000-0000-0000-000000000000}^` Accesses:
%%4416^` ^` Access Mask: 0x1^` Privileges Used for
Access Check: -^` Restricted SID Count: 0
1 row selected.
SQL> -
Problem with a text field check
When there is nothing placed inside the text field it will return a message dialog box saying that there is nothing located inside the text field. However if there is something inside the text field it will perform a
doSpellingSuggestion and write the results to a .txt file.
This works as the search term can be found within the .txt file.
However when I try to display a message dialog box to display the contents of the .txt file that contains the spelling suggestion it will come out with an error from the catch statement
catch(Exception spelling_error)
JOptionPane.showMessageDialog(null , "Spelling error = " +
spelling_error.getMessage());
It keeps showing an error message box saying "Spelling error = null"
It wont go past this line and thats the problem that i have. I tryed putting
I tried substituting this in place of the error message above but it wouldnt go down to it
//Display a message with a spelling suggestion
JOptionPane.showMessageDialog(null , "Did you mean to spell " +
search_term + " like this " + buffer.toString());
but this didnt work
class spellcheck_button_listener implements ActionListener
public void actionPerformed(ActionEvent spelling_check)
try
String myKey = "0RK+HoNQFHJlcbNPfxgBpcjESUWV96aO";
String wsdl = "http://api.google.com/GoogleSearch.wsdl";
String url = "http://api.google.com/search/beta2";
String ns1 = "urn:GoogleSearch";
String ns2 = "urn:GoogleSearch";
if((search_field.getText() == null) || (search_field.getText().equals("")))
JOptionPane.showMessageDialog(null , "No search term entered in text field"
+ " please enter another search term");
else
search_term = search_field.getText();
//Create the connection
SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();
//Create the actual message
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
//Create objects for the message parts
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody bodyName = envelope.getBody();
SOAPElement bodyElement;
//Populate the message by adding SOAP body elements to form a semantically meaning
//SOAP request
bodyElement = bodyName.addBodyElement(envelope.createName("doSpellingSuggestion" , "ns1" , ns1));
//Adding content to the message
//addTextNode used when entering strings , addAttribute used for integers
bodyElement.addChildElement(envelope.createName("key")).addTextNode(myKey);
bodyElement.addChildElement(envelope.createName("q")).addTextNode(search_term);
//Send the message and get a reply
URLEndpoint endpoint = new URLEndpoint(url);
//Send the message
SOAPMessage reply = connection.call(message , endpoint);
//Getting the content of a Message
SOAPPart sp = reply.getSOAPPart();
SOAPEnvelope env = sp.getEnvelope();
SOAPBody replyBody = reply.getSOAPPart().getEnvelope().getBody();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Source styleSheet = new StreamSource(translate_file);
Transformer transformer = transformerFactory.newTransformer(styleSheet);
Source sourceContent = reply.getSOAPPart().getContent();
StreamResult result = new StreamResult(spell_check_file);
transformer.transform(sourceContent, result);
java.util.Iterator iterator = replyBody.getChildElements();
while (iterator.hasNext())
bodyElement = (SOAPBodyElement)iterator.next();
String url_results = bodyElement.getValue();
//Close the connection
connection.close();
FileReader inputFile = new FileReader(spell_check_file);
buffer = new StringBuffer();
// write new list to standard out
BufferedReader in = new BufferedReader(inputFile);
String input;
while ((input = in.readLine()) != null)
if(!input.startsWith("<?xml version"))
// Skip XML header
buffer.append(input + "\n");
in.close();
//Display a message with a spelling suggestion
JOptionPane.showMessageDialog(null , "Did you mean to spell " + search_term +
" like this " + buffer.toString());
} //End of else statement
} //End of try method for search action performed
catch(Exception spelling_error)
JOptionPane.showMessageDialog(null , "Spelling error = " +
spelling_error.getMessage());
} //End of method actionPerformed for search button
} //End of class spellcheck_button_listener implements ActionListenerI don't use SOAP, so I can't test your code.
If you really want people to read your code then it should be [url http://forum.java.sun.com/features.jsp#Formatting]formatted so it is readable with correct indentation of lines and highlighting of the source code. -
How to link a check box with a text field
Hello, I'm looking for some help with my PDF form. If a check box is checked then I would like to force the user to input a value a related text field. First, is this possible and if so can anyone give me some guidance on how to achinve this. I'm currently using LiveCycle 8.0..
Thanks for your help...Go to the check box's properties and in the Options tab choose "Cross" as the check box style.
-
Can I copy a form with spry text fields?
I have two forms that are almost identical with the exception of a few fields. Instead of completely redoing the 2nd form I would like to just save the document in dreamweaver with a new name and change/add the fields I need. I've used spry text fields though. Will I have any issues with just copying and then changing this form as far as the spry files are concerned or am I just better off creating a whole new form?
Keep in mind that form field names need to exactly match your form-processing script.
Spry was abandoned by Adobe in late 2012. Since I don't use Spry for anything, I can't honestly say if the form validation will continue to work or not. I much prefer the ease of HTML5 form validation alone or with jQuery for older browsers.
HTML5 Form with jQuery Validation
So my answer is rebuild with HTML5 forms.
Nancy O.
Maybe you are looking for
-
Dbms_xmlgen: write emp content to xml file
Hi. I have the following procedure to write the content of the emp table in xml to a file: CREATE OR REPLACE PROCEDURE BSP_DBMSXMLGEN IS v_ctx DBMS_XMLGen.ctxHandle; v_file Utl_File.File_Type; v_xml CLOB; v_more BOOLEAN := TRUE; l_exception varchar2(
-
Dear all, I have encountered a strange problem on writing GUI with Java. My JFrame contains serveral JTextFields, sometimes the cursor will lost, even though I click on the JTextFields, the JTextFields cannot gain the focus. On the other hand, someti
-
How can I have the link for downlaod PS PS6 student version ?
Hello everyone, Who can help me ? I have already the key product of PS PS6 student version but I lost the installation CD. How can I have the link for downlaod PS PS6 student version ?? Thanks
-
My iPad doesn't see TV shows that I've downloaded to it even though they show up as taking up 6.35 GB of video memory on the "Capacity" screen (bottom graph) which is what they equal in iTunes. I play them fine on my iTouch and iPods. I open the "iPo
-
After a system restore, my iphone 4 won't move past the set up screen when syncing with itunes, what happened? How can I fix this?