<h:commandLink> action not invoke if include with <ui:include> - google-app-engine

If I place inside an include file, the action will not call back bean.
Main File:
<h:form id="ifLogin">
<h:panelGrid
rendered="#{userSession.isLogin}"
columns="2" columnClasses="columnAlignLeft, columnAlignRight"
border="0" cellpadding="0">
<ui:include src="\test.xhtml" />
...
</h:panelGrid>
</h:form>
Include file (test.xhtml)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:panelGrid border="0" columns="4">
<h:graphicImage value="#{msg.urlImageHome}"
style="height:26px;width:26px;" />
<f:subview>
<h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"
action="#{pageNavigationBean.updateCeaAppName}">
<f:param name="requestName" value="CEA_MAIN_PAGE" />
<f:param name="ceaAppName" value="" />
</h:commandLink>
</f:subview>
</h:panelGrid>
</ui:composition>
The workaround is take out include file, directly place the code to main file as below:
Main file (without using include)
<h:form id="ifLogin">
<h:panelGrid
rendered="#{userSession.isLogin}"
columns="2" columnClasses="columnAlignLeft, columnAlignRight"
border="0" cellpadding="0">
<h:panelGrid border="0" columns="4">
<h:graphicImage value="#{msg.urlImageHome}"
style="height:26px;width:26px;" />
<f:subview>
<h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"
action="#{pageNavigationBean.updateCeaAppName}">
<f:param name="requestName" value="CEA_MAIN_PAGE" />
<f:param name="ceaAppName" value="" />
</h:commandLink>
</f:subview>
</h:panelGrid>
...
</h:panelGrid>
</h:form>
I use richface 4.3.1 Odd is this problem not happen when I run from local GAE. After deploy online to GAE, problem occour (i.e if using include then action will not trigger.
Is that a bug in jsf? or richface implementation or GAE? Any help?

Problem identify
It is not cause by using <ui:include>
The problem came out when the include file is dynamic generate from back bean, for example:
<ui:include src="#{pageNavigationBean.appDropDownMenuUrl}" />
If explicit mention the url, it work, for example:
<ui:include src="\test.xhtml" />
Well, if running from my local GAE, both way are working but when deploy online, I need use explicit location instead generate from bean. May be that is due to GAE problem where state is save at Client side (javax.faces.STATE_SAVING_METHOD).

I can't reproduce the problem with exactly the same included code (test.xhtml), but here are some recommendation:
Escape '>' characters (replace >>> by >>>)
Specify id attribute for f:subview (it is required according to tld)
Change backslash ('\') to slash ('/'). So inclusion would be <ui:include src="/test.xhtml" />

Related

Ionic/Angular cant see images in real phone

I have a project about the film-tv series list. But photos isn't seenable in the real phone. I can see it in an emulator or ionic lab but I can't see it on my real phone.
<img style="margin-left: 5%; border-radius: 15px;" src="http://image.tmdb.org/t/p/w500{{item.poster_path}}" height="250px" width="250px" >
It's my code about img. When I use it like that I can see on an emulator like: https://prnt.sc/12jdedl
But when I open it from my phone its shows like: https://prnt.sc/12jddef how can I fix it? Thanks for the help!
Welcome to Stackoverflow. Your curly brackets {{...}} sit in the middle of the src string. They don't have a string interpolation feature. In order to combine two strings in the angular template you may try this:
<img style="margin-left: 5%; border-radius: 15px;" [src]="'http://image.tmdb.org/t/p/w500' + item.poster_path" height="250px" width="250px" >
The error is: ERR_CLEARTEXT_NOT_PERMITTED
From: https://stackoverflow.com/a/67127207/1772933
First, create the Network Security Config file here YOUR_IONIC_APP_ROOT\android\app\main\res\xml\network_security_config.xml.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain>www.example.com</domain>
</domain-config>
</network-security-config>
Then edit YOUR_IONIC_APP_ROOT\android\app\main\AndroidManifest.xml adding android:networkSecurityConfig="#xml/network_security_config" to application.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.ionic.starter">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:networkSecurityConfig="#xml/network_security_config"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!-- ... -->
</application>
<!-- ... -->
</manifest>

Submit data-table in JSF / Primefaces?

I am working on a web application using jsf/ primefaces, netbeans and tomcat.
I have a datatable with some values loaded in from another table and some editable fields. My question is, after the user has edited this table how do i submit the whole table so it can be stored in a database, in a new table?
<h:form id="form" prependId="false">
<h3>All of your Paddocks</h3>
<p:dataTable var="paddock" value="#{paddock.getfromPaddock()}" editable="true">
<p:ajax event="rowEdit" listener="#{paddock.onRowEdit}" />
<p:ajax event="rowEditCancel" listener="#{paddock.onRowCancel}" />
<p:column headerText="Id">
<h:outputText value="#{paddock.idPaddock}" />
</p:column>
<p:column headerText="Name">
<h:outputText value="#{paddock.name}" />
</p:column>
<p:column headerText="Area">
<h:outputText value="#{paddock.area}" />
</p:column>
<p:column headerText="Enter Grass Weight">
<p:cellEditor>
<f:facet name="output"><h:outputText value="0" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput" value="0" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column style="width:32px">
<p:rowEditor />
</p:column>
</p:dataTable>
<h:commandButton value="Log" action="#{paddock.add}" />
</h:form>
Note that the only editable column is the grass column.
First of all, there are two main mistakes which may have undesired side effects:
<h:form ... prependId="false">
Never use prependId. Remove the whole attribute.
<p:dataTable var="paddock" value="#{paddock.getfromPaddock()}">
You should give var a different name than the managed bean. E.g. paddockItem.
As to the concrete question, your other mistake is here:
<p:inputText id="modelInput" value="0" />
You didn't bind the input value to the model. So JSF won't be able to update the model with the submitted values anyway.
Fix it accordingly, e.g.:
<p:inputText id="modelInput" value="#{paddockItem.grass}" />
In the submit method, it'll be right away there in the model.
You should only make absolutely sure that you aren't interacting with the database in the getter method of the <p:dataTable value>, otherwise you will be overwriting the model on every iteration round, hereby basically trashing the submitted values until the last row before the submit method is hit. The strange method name behind the data table value value="#{paddock.getfromPaddock()}" namely suggests that you're doing that. If it were a real property, the average starter would just have used value="#{paddock.fromPaddock}" or so.
See also:
How and when should I load the model from database for h:dataTable

How to avoid validation of input items within af table and javascript

I developed a form which includes table and commandButton. Some input items are required. I want them to validate while just button pressed.
And everything was ok, this scenario was working well. But when table presents only one row, selecting row does not work. See alsa plz: https://forums.oracle.com/forums/thread.jspa?threadID=960512&start=0&tstart=0 --> might be 9th post
I applied to my jsff the solution which is told in above link. It works previous issue but this time, javascript caused another problem that is inconsistent validation. As i understood java script overrides af table immediate="true" property. plz see : http://www4.picturepush.com/photo/a/11897217/640/11897217.png
How can i resolve that? Any suggestion?
Plz help me
Thanks in advance
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:f="http://java.sun.com/jsf/core">
<trh:script>
function tableLoad(event)
{
AdfCustomEvent.queue(event.getSource(), "refreshTables",
{
},
true);
event.cancel();
}
</trh:script>
......
<af:table var="row" rowBandingInterval="1" id="entityT"
value="#{pageFlowScope.incomingPaperworkBean.baseRowCollection}"
partialTriggers="::cb_incPaperDef_commit ::cb_incPaperDef_filter"
rowSelection="single" columnBandingInterval="0"
disableColumnReordering="true" columnStretching="column:c3"
styleClass="AFStretchWidth" autoHeightRows="20"
contentDelivery="immediate" immediate="true"
binding="#{pageFlowScope.incomingPaperworkBean.richTable}">
<af:clientListener method="tableLoad" type="click"/>
<af:serverListener type="refreshTables"
method="#{pageFlowScope.incomingPaperworkBean.refreshTables}"/>
<af:column id="c5" width="105">
<af:inputText id="registrationText"
value="#{row.baseEntity.registrationNumber.registrationNumber}"
required="true" readOnly="true" autoSubmit="true"
disabled="true"/>
<f:facet name="header">
<af:panelGroupLayout id="panelGroupLayout1" layout="vertical">
<af:inputText id="filterRegistrationNumber"
value="#{pageFlowScope.incomingPaperworkBean.filterTemplate.incomingPaperwork.registrationNumber.registrationNumber}"
simple="true" autoSubmit="true"/>
<af:spacer width="10" height="10" id="spacer1"/>
<af:outputText value="Kayit Numarasi" id="outputText6"/>
</af:panelGroupLayout>
</f:facet>
</af:column>
......
Set the immediate parameter on the component clicking on which fires the validation.

Why is "cc" null inside a commandButton's action in my Facelets composite component?

I have a Facelets Composite component that includes, among other things, a commandButton:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<ui:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:nc="http://compositecomps.sss.evla.nrao.edu/jsf"
xmlns:opt="http://java.sun.com/jsf/composite/components/opt"
xmlns:undo="http://undo.sss.evla.nrao.edu/jsf"
xmlns:n="http://sss.evla.nrao.edu/jsf"
xmlns:f="http://java.sun.com/jsf/core">
<cc:interface>
<cc:attribute name="value" type="edu.nrao.sss.tools.obsprep.bulkedit.BulkEditor" required="true"/>
<cc:attribute name="loop" type="edu.nrao.sss.tools.obsprep.uiactions.project.scan.ScanLoopUIActions" required="true"/>
</cc:interface>
<cc:implementation>
<ui:param name="loop" value="#{cc.attrs.loop}"/>
<ui:param name="val" value="#{cc.attrs.value}"/>
<ice:panelGroup id="wizStep1"
rendered="#{val.readyToSelect}">
<nc:header value="select fields to filter on"/>
<ice:commandButton value="#{val.nameField.value}" action="#{val.select}"/>
<table cellpadding="5">
<thead>
<tr>
<th></th><th>Field</th><th>Search For</th><th></th>
</tr>
</thead>
<tbody>
<opt:bulkEditField value="#{val.nameField}">
<f:facet name="summary">
<ice:inputText value="#{val.nameField.value}"/>
</f:facet>
</opt:bulkEditField>
</tbody>
</table>
<ice:commandButton value="Select" action="#{val.select}"/>
</ice:panelGroup>
</cc:implementation>
</ui:component>
I've changed the code to use val.nameField.value as the label for the first command button to demonstrate the problem.
When I use this component in a page, it renders the button and a list of searchable fields below it. If I change the value of the name field, the button label changes.
However, if I click the button, I get a target unreachable exception:
Caused by: javax.el.PropertyNotFoundException: /resources/components /opt/bulkEdit.xhtml #25,79 action="#{val.select}": Target Unreachable, identifier 'val' resolved to null
I feel like I must be missing something fundamental to how these composite components work. This worked fine as a tag file under facelets/JSF 1.2. In the process of upgrading to JSF 2.0, I wanted to move on to using composite components so I can have a defined interface.
If I stop using <ui:param/> and put cc.attrs.value in directly, it tells me that cc is null.
I thought this could be a bug in icefaces, but switching to plain <h:commandButton/> does the same thing.
Thanks for any advice you may have.
This is a bug in ICEfaces 2.0. You have a UISeries (panelTabSet or dataTable) that contains the composite component. See http://jira.icesoft.org/browse/ICE-7142. It's fixed in 3.0.

Search a string in file using C language

I am getting problem with FILEs concept in C language.
My problem is I have a html file , and that was opened in read mode.
I need to get the data from that file. The acurate is i between the two strings.
The strings are "<Response>" and "</Response>".
The text file is shown below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
<form name="form1" method="post" action="pos_fis_transactions.aspx?trans=14%7c35381192%7c10-10-2011%7c1000.0%7c10-10-2011%7cCASH%7cCREDIT%7cc%7cGCC" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE3NDI1ODEyMjhkZKgy7LmL8WTr+VEeDUOifRqzISfa" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLEypqSAQKez72pDln9yKosD6kd+LvgBmdrWkYoLk2u" />
<div>
<textarea name="txtTransAck" rows="2" cols="20" id="txtTransAck">**<Response>14|245</Response>**</textarea>
</div>
</form>
</body>
</html>
In the above html file, I need to pick the data 14|25.
First of all you are not looking for <Response> and </Response> but <Resonse> and </Resonse> .
If the file is not too big, load it into memory and do a
strnstr( loadedFileContent, "<Response>", lengthOfLoadedFileContent );
This gives you a char pointer to the first & - now add strlen( "<Response>" ) to that, and you arive at your content.
Now either you know the length of your content and read it, or search from that position on for the nest & and take the string in between.
hth
Mario

Resources