myfaces partialTriggers - triggers

Here is my myFaces Code the
<tr:commandButton text="Calculate Modulus" action="#{pageManager.form.calculateModulus}" id="modulusCalculation" partialSubmit="true"/>
<tr:table value="#{pageManager.form.modulusCollection}" var="modulus" width="75%"
inlineStyle="align:center;" partialTriggers="modulusCalculation" autoSubmit="true">
<tr:column headerText="Combination">
<tr:outputLabel value="#{modulus.combination}" />
</tr:column>
<tr:column headerText="Modulus">
<tr:outputLabel value="#{modulus.modulusValue}" />
</tr:column>
</tr:table>
Here when I click a button I want my table to get refreshed but this does not happen
The button code has many lines and the lines that affect my table are:
HashMap<String, Object> modulusInfo = new HashMap<String, Object>();
modulusInfo.put("combination", combination);
modulusInfo.put("modulusValue",modulus);
modulusCollection.add(modulusInfo);
On my console I get the following error:
Dec 30, 2009 5:05:07 PM org.apache.myfaces.trinidadinternal.context.RequestContextImpl addPartialTriggerListeners
WARNING: Could not find partial trigger modulusCalculation from CoreTable[UIXFacesBeanImpl, id=j_id_jsp_1481482420_15j_id_1]
Can anyone tell me what is wrong in the code ?

in your table the partialTriggers="modulusCalculation" should look like this: partialTriggers=":modulusCalculation"

Related

How can I get rid of PDF startxref error and AbstractRenderer warning messages when generating PDF documents and then merging it using iText 7?

I am using iText version 7.1.6 to generate PDF documents and in the end I am trying to merge it.
Below is the code used for merging along with comments.
List<byte[]> pdfDocumentList= new ArrayList<byte[]>();
// pdfDocumentList has list of byte arrays generated from other ways
ByteArrayOutputStream mergeOutputStream = new ByteArrayOutputStream();
PdfDocument pdfMerged = new PdfDocument(new PdfWriter(mergeOutputStream));
PdfMerger merger = new PdfMerger(pdfMerged);
ByteArrayOutputStream finalOutputStream = new ByteArrayOutputStream();
PdfWriter writer = new PdfWriter(finalOutputStream);
PdfDocument pdf = new PdfDocument(writer);
// sb is containing the concatenated HTML sources
HtmlConverter.convertToPdf(sb.toString(), pdf, properties);
pdf.close();
pdfDocumentList.add(finalOutputStream.toByteArray());
if(!pdfDocumentList.isEmpty()){
for(byte[] bytes : pdfDocumentList){
PdfDocument externalPdf = new PdfDocument(new PdfReader(new ByteArrayInputStream(bytes)));
merger.merge(externalPdf, 1, externalPdf.getNumberOfPages());
}
}
pdfMerged.close();
return mergeOutputStream.toByteArray();
When I am merging the list of PDF documents, I get the below error and warning. In addition, the warning keeps getting printed multiple times. How can I fix it?
Warning
WARNING: The background rectangle has negative or zero sizes. It will not be displayed.
Jul 18, 2019 2:24:24 PM com.itextpdf.layout.renderer.AbstractRenderer drawBackground
Error
<Jul 18, 2019, 2:27:19,964 PM AST> <Error> <com.itextpdf.kernel.pdf.PdfReader> <BEA-000000> <Error occurred while reading cross reference table. Cross reference table will be rebuilt.
com.itextpdf.io.IOException: PDF startxref not found.
at com.itextpdf.io.source.PdfTokenizer.getStartxref(PdfTokenizer.java:262)
at com.itextpdf.kernel.pdf.PdfReader.readXref(PdfReader.java:753)
at com.itextpdf.kernel.pdf.PdfReader.readPdf(PdfReader.java:538)
at com.itextpdf.kernel.pdf.PdfDocument.open(PdfDocument.java:1818)
at com.itextpdf.kernel.pdf.PdfDocument.<init>(PdfDocument.java:238)
Truncated. see log file for complete stacktrace
>
2019-07-18 14:27:19 ERROR user: KALASINX ip: 127.0.0.1 (ServiceInterceptor.java:59) ~ ServiceInterceptor Error:
com.itextpdf.kernel.PdfException: Trailer not found.
at com.itextpdf.kernel.pdf.PdfReader.rebuildXref(PdfReader.java:1064) ~[kernel-7.1.6.jar:?]
After analyzing the HTML code and with repeated testing, I was able to get rid of the warning message. I had to remove the background-color style in the CSS of the HTML that was related to
the table, tr, and td tags.

Selenium - Not able to select option from drop down

Following is the code:
public static void test1() {
System.out.print("\nTo find UserName element");
Select select = new Select(driver.findElement(By.id("drop_down")));
System.out.print("\nElements found");
select.selectByIndex(1);
}
Neither following wroks:
select.selectByIndex(1);
select.selectByValue("1");
select.selectByVisibleText("Super Admin");
It throws an exception:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Cannot locate option with value: 1
<select id="drop_down" style="width:205px;" name="drop_down">
<option value=""></option>
<option value="1">
Super Admin
</option>
<option value="4">
Question Reviewer
</option>
<option value="6">
Evaluator
</option>
</select>
May be the dropdown is not properly loaded, when you try to access it.
Try the below code to wait till the number of options in the dropdown becomes greater than 1, and then select the first option from it:
try{
// Waits for 20 seconds
WebDriverWait wait = new WebDriverWait(driver, 20);
// Wait until expected condition size of the dropdown increases and becomes more than 1
wait.until((ExpectedCondition<Boolean>) new ExpectedCondition<Boolean>(){
public Boolean apply(WebDriver driver)
{
Select select = new Select(driver.findElement(By.id("drop_down")));
return select.getOptions().size()>1;
}
});
//To select the first option
Select select = new Select(driver.findElement(By.id("drop_down")));
select.selectByVisibleText("Super Admin");
}catch(Throwable e){
System.out.println("Error found: "+e.getMessage());
}
Hi as per the first comment bu Subh on Jan 15 at 6:35 I too modified the code but getting the same error as mentioned by Abhinav on Jan 15 at 6:53 after that Subh said "I have edited my code above.. See if it works out for you and let me know too, please.." but I didn't see any modified code after this comment hence this didn't help....finally I searched few other forums and I tried using selectByIndex() as:-
WebElement toactTyp=driver1.findElement(By.name((<Name of the Element to access>)));
Select toactSel=new Select(toactTyp);
toactSel.selectByIndex(2);
It worked well with the above code.....I request to please share the modified code or atleast the lines where the modification has been done as it useful to a lot like me

How to update a DataSource field values?

I need to update a DataSourceTextField. Basically I do this in my code:
DataSourceTextField partDataSourceField = new DataSourceTextField(
partFieldName, constants.partTitle());
partDataSourceField.setValueMap(partCodesList);
documentsResultDataSource.setFields(partDataSourceField,
titleDataSourceField);
That code, generates a "part" list on the DataSource for me to filter the results.
What I've been trying is this dynamically change this list to set it to show only the values that are available on the results. I've tried this with no avail:
DataSourceField partField = documentsResultDataSource.getField(partFieldName);
LinkedHashMap<String, String> partCurrentCodesList = new LinkedHashMap<String, String>();
partCurrentCodesList.put("Test", "Test");
partField.setValueMap(partCurrentCodesList);
Is it possible to accomplish what I need?
I deleted the DataSourceTextField and then :
documentsResultDataSource.setFields(partDataSourceField,
titleDataSourceField);
This is sub-optimal but the best solution I found.

Adding a (automatic) date field in data entry form using Sharepoint Designer 2010

I have a Sharepoint data entry Form for my List (Inspection Table), which has a field called "Date Entered". I want to automatically populate today's date and time when a user clicks on "Add new entry", as I want to use that as audit data.
Now, I wanted to use java script (as after research, this seems the most straight forward way to do so), so I added the following to the NewForm.aspx page:
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<script language="javascript" type="text/javascript">
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10)
{dd='0'+dd;}
if(mm<10)
{mm='0'+mm;}
var formattedToday = mm+'/'+dd+'/'+yyyy;
alert(formattedToday);
document.getElementById('<%= ((TextBox)this.onetIDListForm.FindControl("ff10_1")).ClientID %>').value = formattedToday;
</script>
</asp:Content>
The alert(formattedToday); is just to test if the java script is picked up of course and will be removed in later stage.
Ok.. I get the popup, so the value is calculated correctly and java script works. The problem I have, is putting this value to the "Date Entered" field.
What would be the correct method to call the document.getElementByID?
I have tried multiple variations:
document.getElementById('<%= ((TextBox)this.onetIDListForm.FindControl("ff10_1")).ClientID %>').value = formattedToday;
Or..
document.setElementById("Date Entered").value = formattedToday;
Or..
document.setElementById("ff10_1").value = formattedToday;
Can somebody point me to the correct format, or the way to make this work?
Next to the script above, I think I need the Form field "Date Entered" behavior (enable view) to be set to "False" but that is out of scope at the moment.
Thanks,
Chris
Take a look at this article. It talks about how you can achieve this using jQuery. See sample below and try it out. You will have replace the column name with your corresponding name "Date Entered". This should populate the appropriate textbox for you.
<script type="text/javascript">
$(function() {
$('input[title=DefaultMeFieldNoSpaces]').attr(
{value: 'You are in a twisty maze of passages, all alike.'});
});

NServiceBus "CreateBus()" returning null

I am using NServiceBus 2.6.0.1504 on windows server 2003 32 bit.
The log file generated indicates that everything is getting wired up, but for some reason, "CreateBus()" returns null. Ignore my debugging code :)
SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);
var one = Configure.With(typeFinder.GetAssemblies());
var two = one.DefaultBuilder();
var three = two.MsmqSubscriptionStorage();
var four = three.XmlSerializer();
var five = four.MsmqTransport();
var six = five.IsTransactional(false);
var seven = six.PurgeOnStartup(true);
var eight = seven.UnicastBus();
var nine = eight.LoadMessageHandlers();
var ten = nine.ImpersonateSender(false);
var eleven = ten.CreateBus();
if (eleven == null)
throw new Exception("createbus");
var twelve = eleven.Start();
The exception with the message "createbus" always gets thrown.
This works on my dev box with is Windows Server 2008 R2 64 bit.
Here is my config for the web app.
<MsmqSubscriptionStorageConfig Queue="MedXChangeSubcriptions" />
<MsmqTransportConfig InputQueue="MedXChangeForms" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="MethodFactory.MedXChange.Library" Endpoint="MedXChangeWeb" />
</MessageEndpointMappings>
</UnicastBusConfig>
Any ideas? Any help would be greatly appreciated.
NServiceBus will return null if a bus has already been created. So determine if someone is already instantiating a bus for you.
In my scenario, we were inconsistently defining endpoint configurations. In one process, we would implement IConfigureThisEndpoint and then explicitly configure and instantiate a bus. In another process we would inherit from AsA_Publisher which implicitly creates a bus for you; and when it came time to explicitly define our bus' configuration for this other process we would throw NullReferenceException on the fluent CreateBus method. Removing the AsA_Publisher inheritance resolved the issue.
Hope this helps!