JSF and the Immediate attribute
My JSF application has a JSP page with a dataTable. This table has 2 columns, one is an inputText field the other an outputText field with a CommandLink and Immediate set to true. The dataTable is pre-populated by an array containing objects. I also have a Save button.
When I enter or change a value in the input field and then click my command link (to display additional information about the value in the output field) the value I just entered is lost. My form processes correctly when I hit the Save button and display a result page.
Is there a way to preserve the data values entered by the user and still use the immediate option to avoid validation? Or should I go about this in another way?
Thanks.
make you backing bean in session scope..
Similar Messages
-
Difference between the binding and the value attribute of an Oracle ADF com
Can somebody please tell me the difference between
the binding attribute and the value attribute of any oracle ADF component such as inputText and when would we use one over the other.
THanks,Value represent the value that is going to be displayed by the item.
Binding indicate the backing bean object that represents the instance of the component. -
I'm puzzled with the immediate attribute,if a command button set this attribute to false,then whether a input field set this attribute to true or false,it's useless,that's right?
Hi
Normally fields are made mandatory or optional. You need to make required column field mandatory in customization at following path.
SPRO--> Materials Management --> Purchasing --> Purchase Order --> Define Screen Layout at Document Level --> field selection ( Make mandatory field for relevant field selection group.)
hope it will help u.
Deepak. -
Restriction and the Fixed attribute and JAXB
Hi
I have what I believe is a valid XSD, with two complex types BaseType and OtherType. What I want is for BaseType (abstract) to have an attribute but no fixed value for it. OtherType would restrict the allowable values to just "Test". I have checked the XSD with xmlspy and the W3C site.
so happy with the xsd I try to use JAXB to generate classes:
xjc.bat -p com.me.test example.xsd -d gen
but I get :
[ERROR] derivation-ok-restriction.2.1.1: Error for type 'OtherType'. An attibute use in this type has a REQUIRED setting which is inconsistent with a matching attribute use in the base type.
(removing the Fixed attribute solves it but I'd like to keep it)
Any ideas?
Thanks
Des Field Corbett
XSD Follows:
================================================================================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="BaseType" abstract="true">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="OtherType">
<xs:complexContent>
<xs:restriction base="BaseType">
<xs:attribute name="name" fixed="Test"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="root" type="OtherType"></xs:element>
</xs:schema>Got it to work...
My XSD had the line in BaseTypes:
<xs:attribute name="name" type="xs:string" use="required"/>
and the line in OtherTypes:
<xs:attribute name="name" fixed="Test"/>
Changing this to:
<xs:attribute name="name" type="xs:string" use="required" fixed="Test"/>
Got it to work.
Not sure if this is a Bug in JAXB or its just being fussy... Sure going to make it a pain to hand code in the extra tags in to my real life XSD!
If there is a better way I'd be grateful to know....
Thanks
Des
BTW getting a java.lang.reflect.InvocationTargetException now - but as I'm just learning JAXB so I'm guessing thats something else. -
Lync 2013 custom meeting requests and the CustomFooterText attribute
Hi there,
I've been playing around custom meeting requests in Lync 2013. I need to automatically add some lines of text for a Lync Meeting request, and have been using the CustomFooterText attribute. Unfortunately, this doesn't seem to support carriage return
so all the text is dumped onto one line... and looks very messy.
I've read on one of the posts, that this field supports HTML, and have tried pasting in some HTML codes, but it's still rendered as text in Outlook.
The only way I've managed to do this is to save the desired output as an image, upload it to a web server, and use the -LogoURL switch instead, which essentially inserts a graphic... not ideal, but works.
Does anyone know of a way to insert carriage returns into the CustomFooterText?
Regards, James.
James FrostHi James,
I did some research and testing but found no way to add a carriage return to have this text respect the formatting as entered.
Best regards,
Eric -
Tomcat 5.x, context.xml and the caseSensitive attribute.
Hi,
I have already configured a context.xml file in the CATALINA_HOME/conf/Catalina/localhost with the following content:
<Context path="/mysite" docBase="${catalina.home}/webapps/mysite" reloadable="true"/>
It is working, because the servlets can be reloaded after a modification. My goal is to make the URL recognition of the server for may web application case-insensitive. There is an attribute caseSensitive in the <Context> element? Is that right? And this can turn off case-sensitivity of this web application. This means it should also affect the URL recognition. But wen I change the line in the context.xml to
<Context path="/mysite" docBase="${catalina.home}/webapps/mysite" reloadable="true" caseSensitive="false"/>
and try to access the URL with different case then the original it does not find the page. Is this the right place to put the caseSensitive attribute?i am posting the Car.xml which i created in
/conf/catalina/localhost directory in Tomcat 5.5.7
?xml version='1.0' encoding='utf-8'?>
<Context path ="/Car" docBase="C:\Program
Files\Apache Software Foundation\Tomcat
5.5\webapps\Car" debug="0" />Rather than have you working directory under webapps, you can have it elsewhere in your system and refer to it using the docBase attribute. For example, say you have your work directory in d:\work\car,
then
<?xml version='1.0' encoding='utf-8'?>
<Context path ="/Car" docBase="d:/work/car" />would suffice.
cheers,
ram. -
RSAT and the missing Attribute Editor tab [solution]
PROBLEM
When you install RSAT on a Vista workstation or Server 2008 system, that is managing a 2000/2003 based forest, you do not see the Attribute Editor tab when looking at the properties of a User or Computer object in Active Directory Users and Computers(ADUC).
MORE INFORMATION
The Display Specifier is not updated in the Configuration Naming context, because the 2008 schema changes have not been executed on the forest. Part of the upgrade updates the forest Display Specifiers. The Attribute Editor tab actually uses functions within the ADSIEDIT tool , more specifically the ADSIEDIT.DLL extension. Although the DLL is probably registered on the RSAT system, the ConfigNC need updating, in order to expose the tab in the ADUC interface.
SOLUTION
Use the ADSIEDIT tool (or other tool of choice...ADexplorer, LDP etc), with a user who has rights to modify the Configuration Naming Context.
Navigate to cn=<languagepage>, cn=configuration, dc=<domainname>
(where <languagepage> is your relevant language...see http://support.microsoft.com/kb/324097)
(where <domainname> is your domain dn)
Under the cn=User-Display object, edit AdminPropertyPages and add the line 11,{c7436f12-a27f-4cab-aaca-2bd27ed1b773}
Under the cn=Computer-Display object, edit AdminPropertyPages and add the line 12,{c7436f12-a27f-4cab-aaca-2bd27ed1b773}
Under the cn=Default-Display object, edit AdminPropertyPages and add the line 4,{c7436f12-a27f-4cab-aaca-2bd27ed1b773}
Open ADUC from the Vista or Server 2008 and you should now see the Attribute Editor for the object you selected. Note: Attribute editor is only shown when ADUC is in Advanced View.
-Stuart HudmanNever mind, i got it.... the prefix number is irrelevant as long as it is in sequential order... to be able to see the attribute editor tab for groups i just
Under the cn=group-Display object,
edit AdminPropertyPages and
add the line 5,{c7436f12-a27f-4cab-aaca-2bd27ed1b773}
the first number (5,) was my next available number.
FYI: English is 409. the actual DN would be cn=409,
cn=DisplaySpecifiers, cn=configuration, dc=<domainname> -
Hi,
I have a form in JSF where I add a record to a database. When the user clicks
add, a form appers with the input fields and two buttons add and cancel.
The add button calls the action handler and adds the record to the database
while the cancel redirects back to the main page by using a navigation rule.
My problem is that if the user fills the input fields and clicks cancel then
the next time he tries to add another record the old unsubmitted values are
there. I suppose the values are saved in the component even with if the
cancel button has the immediate attribute.
myHandler is a managedBean with session scope and newRecord is
the object I want to save in the database.
I have misundestood something in JSF propably so any help is very
appreciated.
Thanks
Petros
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:subview id="addRecord">
<h:form>
<h:panelGrid columns="2">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="#{labels.title}"/>
</h:panelGroup>
</f:facet>
<h:outputText value="#{labels.description}:"/>
<h:panelGroup>
<h:inputText id="desc" value="#{myHandler.newRecord.description}" required="true" maxlength="40"/>
<h:message for="desc" styleClass="errorMessage" />
</h:panelGroup>
<h:commandButton value="#{labels.add}" action="#{myHandler.add}"/>
<h:commandButton value="#{labels.cancel}" immediate="true" action="cancel"/>
</h:panelGrid>
</h:form>
</f:subview>Ok, figured out my problem.
Well, I knew the problem; I now have a SOLUTION.
The problem: User enters data, gets a validation error, wants to
discard submitted values and start over. (Cancel / undo / revert.)
Canonical solution:
<h:commandLink value="Undo" action="undo" immediate="true"/>along w/a navigation rule in faces-config.xml:
<navigation-rule>
<from-view-id>/detail.jsp</from-view-id>
<navigation-case>
<from-outcome>undo</from-outcome>
<to-view-id>/detail.jsp</to-view-id> <!-- Note: same view from
which we came -->
</navigation-case>
</navigation-rule>How this works is:
phase "Restore view": old view is dredged up from somewhere (session?
request data?).
phase "Apply Request Values": incoming values are decoded and copied
into components' submittedValue properties (which already have the
same old junky data in them anyway, but never mind).
At the end of this phase, the "immediate" commandLink has caused, in
the course of being decoded, an action event to be queued, and it is
now processed. The action "undo" (static string) is "invoked" (no
joke, I've seen the code), resulting in a return status of... (wait
for it)... "undo"! (The invocation is a no-op. In spite of my
clowning around, it's not a bad architecture.)
Also, since an action was invoked (phase "Invoke Application"), all
other (intervening) phases are skipped and we now go straight to phase
"Render Response", but first....
We look up the action result "undo" in the navigation rules for this
page, and (by virtue of looking up a non-null string) get a hit. (At
least, I THINK we "get a hit" regardless -- even if there's no
matching navigation-case.)
We now instantiate a brand-new view (even if it's the same page we're
going back to), discarding all our carefully-saved submittedValues.
This is exactly the effect we want: skip phase "Update Model" and
discard that submitted junk the user no longer wants.
NOW we proceed w/phase "Render Response", and everything's copacetic.
The old junk doesn't show up, and we rebuild the page from the model
(which probably hits the database).
So much for the "trivial"/canonical case.
Didn't work for me.
The effect I noticed was that the submittedValues kept coming back.
Why?
After much debugging w/the source release and Eclipse (yay!), I
discovered that my use of the "binding" attribute on a component
changed everything.
<h:dataTable id="surveyTable" var="question"
binding="#{surveyMgr.surveyTable}">I keep forgetting this simple truth: value bindings are
two-way. They insert data into your model (1) and pull it back
out (2). Two (2), count 'em, TWO, flows.
Tying the component into the model is fine, if you need access to it
(e.g., to determine what the current row is, for some nefarious/hacky
purpose).
However, after the new, empty view has been instantiated and we begin
to populate the component w/components, I discovered the following
functionality in the JSF source code:
When attempting to instantiate a new component, check to see if the
"binding" attribute was used. If so, evaluate the value
binding, using the UIComponent returned by it instead of creating
a new one.
Youch! Now my old dataTable, complete with its junk submittedValues
comes back into my new, clean view! Even though my bean is request
scoped. (The bean got initialized at the beginning of the request,
before the new view was created, while the old view was still "good".)
So, the real solution:
(Should be fairly obvious.)
<h:commandLink value="Undo" action="#{surveyMgr.undo}" immediate="true"/>
public class SurveyMgr {
public String undo() {
// One of two possibilities here.
return "undo";
}Two possibilities:
(1) Carefully clean out the bean (in particular, the bound UIComponent
properties, storing null in their place). A surgical approach
might be good here, if there's data you want to keep in the bean,
for some reason. Drawback: if some poor developer introduces a
new value binding at some point in the future and doesn't clean it
out during the "undo" operation, they'll be faced w/the same
mystery. At best, they'll have to stop and search for the page
you carefully put into your company's internal wiki (which you
did, right? right?).
(2) Blast the entire bean, as outlined in a previous post in this
thread (createValueBinding().setValue(null)). This seems to work
for me, even though it's a request-scoped bean and we're in the
middle of the request processing. I initialize my bean lazily
with non-Faces hidden parameters (Yet Another Sad Hack), so your
mileage may vary.
Problem solved. For real. (Until I discover that this doesn't work,
either.)
John. -
JSF and JSTL. :'(
I'm trying to include a "jspx" component if the user has a role, but "c:if" seems not to work.
<f:view>
${submenu}
${not empty submenu}
<c:if test="#{not empty submenu}"><jsp:include page="${submenu}" /></c:if>
</f:view>The first 2 lines print
mysubmenufile.jspx
true
... other code, not my included file! :'(
Why it doesn't work. I'm using .tag files, and it works fine, but i've to use scriptlet code, like
<% if (cond) { %>lot of unpretty JSF tags<% } %>
Can somebody help me to fix it?JSTL and JSF don't really play together that well.
I don't know if JSTL tags can understand the #{expr} expr.
Mostly I find it easier to just use JSF.
Any time you include a page, I believe you need to use <f:subview> tags
Why not use that and the rendered attribute to accomplish the same thing:
<f:subview id="submenuView" rendered="#{not empty submenu}">
<jsp:include page="${submenu}" />
</f:subview>Does that work? -
I am new to ADF, I am confused with the immediate attribute.
what happens when i set immediate attribute to true for a input text?
what happens when i set immediate attribute to true for a command button?
i am using jdev 11.1.2.2.0
ThanksHi,
This should give you a clear picture of it : https://cwiki.apache.org/confluence/display/MYFACES/How+the+immediate+attribute+works
And this also : http://adfpractice-fedor.blogspot.com/2012/02/understanding-immediate-attribute.html
Doc : http://docs.oracle.com/cd/E23549_01/web.1111/b31973/af_lifecycle.htm#CIACBJCJ
-Arun -
Removing quarantined devices when the mailbox attribute has been deleted
I have a few Exchange 2010 mobile devices in quarantine that belonged to employees that have been termintated and the mailbox attribute removed. when I try to remove the devices using;
Get-ActiveSyncDevice | Where {$_.DeviceAccessState -eq "Quarantined" -and $_.FirstSyncTime -lt (Get-Date).AddMonths(-6)} | Remove-ActiveSyncDevice -Confirm:$false
I get an error stating
Couldn't find '<AD domain>/<OU path><Username>,as a recipient.
+ CategoryInfo : InvalidArgument: (:) [Remove-ActiveSyncDevice], RecipientNotFoundException
+ FullyQualifiedErrorId : 44C6758C,Microsoft.Exchange.Management.Tasks.RemoveMobileDevice
is there a way to remove the device after the mailbox has been removed?Hi,
Maybe below links can help you.
http://exchangeserverpro.com/exchange-2010-error-activesyncdevice-cannot-be-found-remote-wipe/
http://vanbrenk.blogspot.nl/2014_01_01_archive.html
http://www.msexchangegeek.com/2013/10/
KR.
Itechin -
I've just started playing around with this and was looking for samples/tutorials to help. Of the tutorials/samples I've seen, they appear to fall short of explaining an end-end example and stick mostly to JSF and the backing bean - usually displaying static data within a JSP and navigation. I'm a bit confused on how to call custom methods in my business services (application modules) and in turn use the view objects to fetch data from my database and display the results within a JSP using the JSF components.
I realize the latest preview JDeveloper is without ADF but while I had time I was hoping to play around with ADF Faces to hit my development database. Guess I'm trying to make sense of how JSP, JSF, Business components, and my db connection all play together in order to set up a decent starting point for an app.You could use Jdeveloper 10G and play around with ADF Faces, look at the demos, and the sources behind them.
There are a couple of papers on OTN like...
Working with ADF Faces in JDev 10g:
http://www.oracle.com/technology/products/jdev/howtos/10g/adfjsf/how-to-adf-faces-10gjdev.htm
Roadmap for ADF Faces:
http://www.oracle.com/technology/products/jdev/collateral/papers/9.0.5.0/adfuix_roadmap/adfuix_roadmap.html
And many more... as I could find upon search...
http://www.oracle.com/ultrasearch/wwws_otn/searchotn.jsp?p_Action=Search&p_Query=adf+faces
The visual editing support for 'The ADF Model access through ADF Faces bindings' is under development (hence no tutorials), and will be available in future release (could be post 10G release).
-Udupa -
Hi,
have somebody experience with JSF and the IBM StatePattern?
Thanks
Ich ben�tige eine Antwort auf die Frage: Kann ich das StatePattern mit JSF verwenden und WIE?
DankeA couple things here:
What kinds of services do these protected methods
provide. Are you sure that this is the only way to
structure this?
The kind of services the base class provides are very critical which the child classes can't do and shouldn't care. For eg: the base class waits on a lock object for some action to be done by some other module in the code.
I have tried to restructure it a bit, there are other child classes for this base class on which I dont have the direct control. The only reason why I am a state pattern here is to avoid a big switch case or if else statements.
There are two ways to restrict access to something in
Java: 1. make that something protect,
package-protected, or private or 2. Restrict access
to the Object itself. What I mean is that you can
make a method public but only those classes that can
get access to the Object reference can call it. Yes,
everyone can see that the method exists but that's
rarely, if ever, going to matter.
And I can't make the methods public because they are all as I said critical functions which only the child is allowed to do and that too only through inheritence. It is making perfect sense for the base class to keeping them protected.
It seems like there is no other way but to redeclare them and delegate the call to super.
Thank you! -
JSF and ADFBC: How to Run a method every time the page is posted back
Hi everyone,
I am using ADFBC and JSF in my project, and there is a page which runs the following logic: The page displays a set of radio options and a submit button. It has a total of 4 options, but they never display all at once. For example, when user enters the page for the first time, only selectItem 1 displays. When it clicks on the submit button, the page is posted back and hides the first select item, showing now the second, and so forth. The steps i did to achieve this are:
1 - Created a method on the App Module that inserts a row corresponding to the select item choice.
2 - Created another method that verifies which is the lastly entered row and returns a string containing the relevant attribute, for example, "E".
3 - Created the methodAction binding to run the insertMethod (1) and retrieveMethod (2).
4 - Created an invokeMethod executable for the retrieveMethod (2) and set the refresh property to "always".
5 - Created a variableIterator with a variable to hold the retrieveMethod return, also setting the refresh to "always".
6 - Lastly, bound the "rendered" attribute of each select item to the variable's value, for example "#{bindings.returnVariable == 'E'}
When i run the page, the logic works almost fine, except for one detail: When the user clicks the button that calls insertMethod, the page is posted back, and i assume the selectItems should be re-rendered accordingly. Yet, the button click inserts the row in the DB (called insertMethod) but keeps showing the previous radio item. If i restart OC4J, when i enter the page again the radio is now correct, showing the next option.
Do you know how can i tell the page that the model has been refreshed, so it runs the retrieveMethod again, alters the variable and the radio options without having to leave the page or restarting OC4J?
Thanks in advance for your help!
Regards
Thiago SouzaHi all,
It seems i have figured out the error. It was a logic mistake on my method, ADF was doing the refreshes just fine. There is another little question i wanted to ask now: I need to execute a JSF Navigation Case when the page loads, in order to navigate to another page due to a certain condition. is there any way to run some logic to redirect the request before the page has been rendered, just like the onLoad() javascript event runs on the body every time it gets loaded?
What i'm trying to do exactly is this: When the login.jspx page runs the "success" navigation case, it goes to "page1.jspx". But before "page1.jspx" is loaded, i need to run an Application Module method to check for a certain situation; if this criteria is not met, i must run "fail" navigation case, from "page1.jspx" to "page2.jspx" without ever displaying page1.jspx.
Is it clear enough? Can you guys give me some pointers on how to do it?
Thanks a lot!
Thiago -
When printing a list in Address Book, how can I select more than the default Attributes and keep them selected when I print again? I want to print ALL information for contacts so I have email address, notes, phone, company, title, etc all on one page. I don't want to have to check off an additional 5 or 6 attributes each time I print out contact information. Is there a way to change the default setting for printing lists, so it is not just "phone," "photo," and "job title?"
I have a user who wants to do this same thing. I did not find any way either to default the attributes to anything other than what you see the first time. Seems like such a trivial thing, hard to believe they do not allow it. I did find a program for this called iDress but I can't seem to download it from any links on the Internet. Not sure if it is free or not, but it was recommended by a link on the Mac support site.
Maybe you are looking for
-
How to call java program from javascript
Hi, I have an java program which will transform one xml to another xml using XSLT. I want to call this java program from Javascript? Is this possible? Please suggest me. Thanks, Gopal
-
Technical system definitions on multiple SLD servers in a SAP landscape
Hi, If we want to migrate an SAP SLD server from Solution manager application to ECC application(s). In this process solution manager's SLD server data will be migrated into multiple servers at ECC environment(say for example, we define one SLD serve
-
Files get open with single click sometimes
I recently started having this problem. When I browse through different image/video files, some of the files get open with one click only. This is really very annoying. I am event thinking to migrate back to Windows because of this problem. How to re
-
So can I know when can I reinstall the game ?
-
Do MG 3120 and MG 6220 work with Android phones for wireless printing?
Hi People, I just joined this forum and hopefully some of you can tell me if the MG 6220 or MG3120 printers work with Android phones to wireless print from the phone. I looked at the specs from the Cannon website on both machines and could not find