JP Estrada

Ranch Hand
+ Follow
since Mar 21, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by JP Estrada

No errors in the logs. It just doesn't render in IE
13 years ago
Has anyone encountered this problem before? I'm trying to render a PDF document through the browser. It's working fine in Firefox, but i get an "IE cannot display the page" error page. Here's my code:

String xml = "<PdfBean/>";
StreamSource xmlSource = new StreamSource(new ByteArrayInputStream(xml.getBytes()));

InputStream is = new
ByteArrayInputStream(xsltext.getBytes("UTF-8"));
StreamSource xslSource = new StreamSource(is);
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer(xslSource);

FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
foUserAgent.setProducer(this.getClass().getName());

ByteArrayOutputStream out = new ByteArrayOutputStream();

Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,out);

// perform transformation
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(xmlSource, res);

//Prepare response
httpResponse.setContentType("application/pdf");
httpResponse.setContentLength(out.size());


//Send content to Browser
httpResponse.getOutputStream().write(out.toByteArray());
httpResponse.getOutputStream().flush();
13 years ago
Right. Thanks guys
14 years ago
yes a filter is a good idea. I see you can set the values of existing headers by overriding the getHeaders(string) method of the HttpServletRequestWrapper. But what if want to add a new header name with a specific header value?
14 years ago
yes right. by the browser. What i'm trying to do is simulate what Siteminder does during preauthentication. It adds a header called SM_USER to the browser generated headers. Our project is not setup with a real siteminder yet so we need to manually add SM_USER to the headers so development could continue.

There is a Firefox plugin called Modify Headers that allows you to add headers. Unfortunately i can't find a similar tool for Internet Explorer. And we have to test the pages in IE too. I'm wondering if this can be done by using the URLConnection class?
14 years ago
Is there a way to add http headers to a request every time a page is called? I mean aside from the usual http request headers generated, is there a way to add something like "aNewHeader: test1"?

What i need to happen is, every time i call a page from my project using Internet Explorer, there will always be a "aNewHeader" appended to the list of the container generated request headers.

I'm using HttpURLConnection's addRequestProperty() method. This works when i call a java application and call the addRequestProperty method. A new header will be added to the specified URL object..

But i can't find a way to have the "aNewHeader" header added when calling the page from IE.
14 years ago
Ahh.. i got it. i shouldn't be using HtmlInputText.. I should use UIInput!
15 years ago
JSF
Hi guys.. i need help here. I need to create a datatable with dynamic number of columns. this is m code for that:

public void createTableStructure()
{
table = new UIData();
Application app = FacesContext.getCurrentInstance().getApplication();

UIColumn col1 = new UIColumn();
UIOutput header = new UIOutput();
col1.setId("colCountry");
header.setValue("COUNTRY");
col1.setHeader(header);
ValueBinding vb = app.createValueBinding("#{dynamic.country}");
//HtmlOutputText out = (HtmlOutputText)app.createComponent(HtmlOutputText.COMPONENT_TYPE);
HtmlInputText in2 = (HtmlInputText)app.createComponent(HtmlInputText.COMPONENT_TYPE);
in2.setValueBinding("value",vb);
col1.getChildren().add(in2);

UIColumn col2 = new UIColumn();
UIOutput header2 = new UIOutput();
col2.setId("colCity");
header2.setValue("CITY");
col2.setHeader(header2);
ValueBinding vb2 = app.createValueBinding("#{dynamic.city}");
HtmlOutputText out2 = (HtmlOutputText)app.createComponent(HtmlOutputText.COMPONENT_TYPE);
out2.setValueBinding("value",vb2);
col2.getChildren().add(out2);

table.getChildren().add(col1);
table.getChildren().add(col2);

String[] arr = getTestArray();

for(int x = 0;x < arr.length ;x++)
{
UIColumn col = new UIColumn();
UIOutput h = new UIOutput();
col.setId("col" + x);
h.setValue(arr[x]);
col.setHeader(h);
ValueBinding vb3 = app.createValueBinding("#{dynamic.sectors[" + x + "]}");
//HtmlOutputText out3 = (HtmlOutputText)app.createComponent(HtmlOutputText.COMPONENT_TYPE);
HtmlInputText in = (HtmlInputText)app.createComponent(HtmlInputText.COMPONENT_TYPE);
in.setValueBinding("value",vb3);
col.getChildren().add(in);

table.getChildren().add(col);
}

}


I'm able to create this table and populate its contents, which are displayed inside input text boxes. But when i change the contents displayed in the inputTexts, everytime i submit the form, the contents change back to their original value. It doesn't reflect the changs i made.

What am i doing wrong here?
15 years ago
JSF
Thanks for replying Darryl.. i did some testing, with the table. I bound the same property to an outputText, checkbox and a inputText. The outputText reflected the change, but the checkbox and inputText did not. Have you encountered this problem before?

here's my JSF:

<h:inputHidden id="testText2" value="#{vararrCities.selectedStr}"/>
<h:outputText id="testText" value="#{vararrCities.selectedStr}" rendered="true"/>
<h:selectBooleanCheckbox id="checkbox1"value="#{vararrCities.selectedStr}" />



i updated it this way in my backing bean:

city[0] = new CityBean();
city[0].setCity_id(444);
city[0].setSelectedStr("false");
city[0].setCity_name("TEST CITY");
15 years ago
JSF
How come when i change the contents of the array to which the datatable is bound, the datatable does not reflect the change?

I have a checkbox for each row in the datatable. they are bound to a boolean property of an object.. but when i change the values, and run in debug mode, i do see that there values of the array changes. but it just doesn't show in the datatable..why is that?
15 years ago
JSF
I have a table that i need to map that does not have primary keys. The only 2 fields are used in many-to-one relationships.
So i used a composite id in my mapping:


<hibernate-mapping>
<class name="com.middle_table" table="middle_table">
<composite-id>
<key-property name="int_col1_id">
<column name="COL1"/>
</key-property>
<key-property name="int_col2_id">
<column name="COL2"/>
</key-property>
</composite-id>

<many-to-one name="col1_id" class="com.Col1" />
<many-to-one name="col2_id" class="com.Col2" />
</class>
</hibernate-mapping>


I added 2 int versions of the actual db field to my pojo. ex. Since col1_id is already used for a many-to-one association, i created an int_col1_id..

Now i'm having problems because i can't insert a new record into the table. It's saying col1_id is specified twice..

What is the right way to map a table with no primary keys in such way that i can insert new records into it?
I have an application that displays a javascript confirm dialog box. what should happen is that when the user chooses OK option, the action method in the backing bean executes. When CANCEL is chosen, the action method does not get executed. I put the javascript in the onmousedown event of the commandLink since there is no onclick in the commandLink in IBM RSA.

This is working fine in IE. But in Firefox, the action method in the backing bean gets executed even before an option in the confirm box is chosen. is there a workaround for this?
15 years ago
JSF
i found should just set the escape attribute to false
[ June 29, 2008: Message edited by: JP Estrada ]
15 years ago
JSF
How do i populate a <td> with a   through java code?

I tried doing something like someProperty = " ". But i'm getting a "&nbsp;" in the generated html text...

how do you guys do this?
15 years ago
JSF