Help coderanch get a
new server
by contributing to the fundraiser

Pinal N Patel

Ranch Hand
+ Follow
since Sep 05, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Pinal N Patel

Hello Everyone,

Is there a JSF component/framework that allows to upload multiple files at one time. Users should be able to click on the browse button and select multiple files to upload rather than having many different browse button.

I have implemented successfully to upload one file at a time and I would highly appreciate any insight all of you might have to help me towards implementing mulitple files at one time.

thanks in advance!!

Regards
16 years ago
JSF
Hello everyone,

I am building a web page with functionality for user to upload (using the browse function) their pictures (jpeg format) into the application. Once the picture is uploaded, I display the picture in a thumbnail fashion along with date/time of when the picture was taken. I am reading the Jpeg's Exif data using Open source tool called "Metadata Extractor" to retrieve picture taken time for display purpose.

The problem is that when I read the picture taken time, which is of Date object, I can not read the timezone information from the date object. Rather, I can not even modify it; the date object gets assigned the default timezone on where the server is located.

For example: If I take a picture at 2PM in EST timezone and if the server is in PST timezone, then when I upload the jpeg, the date object is misrepresented with 2PM of PST (PST is added to the date obects as a default server timezone) when the correct time is 2PM of EST. In this case, the date/time data is incorrect.

Please kindly provide any insight to resolve this issue. I appreciate any help I can get.

Thanks in advance as always!!

Regards
16 years ago
Hello Everybody,

I am building a web page using JSF technology. One of the page has a function to upload pictures into the application and then can be viewed in a thumbnail manner.

My question is realted to Java API not JSF, one of the requirement is to display "picture taken time" along with the picture. Currently, the page displays the time when the picture was loaded as oppose to when the picture was taken. The picture format are usually in JPEG/GIF. Is there a way to retrieve the "picture taken time" from JPEG/GIF file through Java API?

I would highly appreciate any response I can get to complete this requirement.

Thanks in Advance!!

Regards
16 years ago
Hi everyone,

I am using Tomahawk Extended_datatable to render nested lists for display. I am using Tomahawk 1.1.7_Snapshot verion (latest nightly build).

My requirement is to display the table horizontally and apparently, using Tomahawk datatable's newspapercolumns should display horizontally. But the newspapercolumns does not take dynamic value using EL expression; it onlys works on static value. The current version of Tomahawk should supposedly fix the bug, but its still not working.

So, I am wondering if anyone has faced similar issue or faced similar requirement to display table horizontally. If yes, I would HIGHLY appreciate any insight you can provide to resolve or find an alternative approach to my issue.

I've also posted @ jsf

Folks, please share your insights.

Thanks
16 years ago
JSF
Hello everyone,

I have a getter method (getPictureList) that gets called during APPLY_REQUEST_VALUES phase. This method is called on the dataTable to retrieve pictures. There is no associated setter method.

My question is why should this method be called during APPLY_REQUEST_VALUES? I thought RENDER_RESPONSE phase would take care of calling this method for rendering the page. As a result, JSF is retreving the same information twice from the database which affects the performance.

Has anyone encountered this strange behavior? Any suggestion is appreciated. Thanks a bunch in advance!!
17 years ago
JSF
I don't need to store it as a timestamp(actually, depends on the database). If I understand correctly, Date object stores upto seconds and Timestamp upto nanaoseconds.

Just figured it, MySQL with DATE type does not store time info, so I changed it to DATETIME and it worked.

Regards,
Pinal
Hello Guys,

I am not able to save Time(hours, min, secs) information contained in Date object into table using Spring-Hibernate framework. I am mapping my Domain object's java.util.Date property to a date column in the table using type="date". Am I missing something here? The date gets stored in the table but not the time contained in the Date object. Any help is appreciated. Thanks in advance!!

Following is my code snapshot.

Hello Everyone,

How can I retrieve entire server path from the request object?

For eg: Say I am accessing an application with URL http://www.temp.com/HelloWorld/index.jsp. Through HttpServletRequest object, How can I retrieve "http://www.temp.com/HelloWorld".

I tried with request.getServerPath and getConextPath, both methods do not return "http://www.temp.com".

Any help would be appreciated in advance!!

Thanks,
Pinal
17 years ago
I've tried both and still no success :-)

Regards,
Pinal
17 years ago
JSF
One more question, I have seen many examples on the internet regarding the user of HTML Data Table with inputText and I assume they all work correctly. But for some reason, the above code does not populate instance variables in the backing bean during UPDATE MODEL VALUES Phase in JSF lifecycle. Please look at the code above and share any thoughts on resolving this issue.

I thought as long as you provide getter/setter in backing bean class, if a component is modified, then those values will be updated to the backing bean class in UPDATE MODEL VALUES. Is this not correct?

Regards,
Pinal
17 years ago
JSF
Thanks Sachin. I added binding attribute to the table and from the action method, I retrieve HTMLDataTable (using getter method corresponding to binding attribute) and get the value of the tables using getValue(). This works and all is well.

However, shouldn't value attribute in the <h:datatable> update getter/setter . Why set binding attribute and making the code little complex? Or, without binding the table, I could retrieve the Table value using facesContext, but this makes code complex too?

I thought JSF dynamically populates table values in the ArrayList(value is set to Arraylist object).

Regards,
Pinal
17 years ago
JSF
Hello Guys,

I have been bumping my head against the wall on this issue. I appreciate any insights...

I have a InputText within a DataTable. When user clicks on "Add New Row" commandButton, it calls ActionListener which calls a method in BackingBean to add a new empty row to the table. Once the new row is created on the web page, the user enters the data in the row and clicks on "Save" which triggers an action call to the backing bean, which for some reason does not retrieve the user entered data. Please see below on code and appreciate any help I can get to resolve this issue.

Thanks in advance. Looking forward to your response anxiously.

Facelets -> content.xhtml
<h:panelGroup>
<t:dataTable id="foodTable" border="1" styleClass="tableStyle"
value="#{foodBean.foodItems}" var="food"
headerClass="tableHeader" rowClasses="tableRow">
<t:column>
<f:facet name="header" id="h1">
<t:outputText value="Item" />
</f:facet>
<t:inputText id="itemId" size="10" styleClass="inputTextClass"
value="#{food.item}" />
</t:column>
<t:column>
<f:facet name="header" id="h2">
<t:outputText value="Calories" />
</f:facet>
<t:inputText id="caloriesId" size="4" value="#{food.calories}" />
</t:column>
<t:column>
<f:facet name="header" id="h3">
<t:outputText value="Fat(Calories)" />
</f:facet>
<t:inputText id="fatCaloriesId" size="4"
value="#{food.fatCalories}" />
</t:column>
<t:column>
<f:facet name="header" id="h4">
<t:outputText value="Portion" />
</f:facet>
<t:inputText id="portionId" size="2" value="#{food.portion}" />
</t:column>
</t:dataTable>
<h:commandButton value="Add Food Items" type="submit"
actionListener="#{foodBean.addItem}"/>
<h:outputText value=" " />
<h:commandButton value="Save Food Items" type="submit"
action="#{foodBean.executeFoodData}" />
<h:outputText value=" " />
</h:panelGroup>


Backing Bean action method called by "Save" commandButton:
public String executeFoodData() {
log.debug("executeFoodData() with foodItems size of "
+ foodItems.size());

Iterator<Food> f = foodItems.iterator();

while (f.hasNext()) {
Food fd = f.next();
log.debug("food Items is " + fd.getItem() + " With Calories "
+ fd.getCalories());
}
foodService.storeFoodDateAll(foodItems);
return Constants.SUCCESS;
}
17 years ago
JSF
Fixed it by using PanelGrid with columns=2.

Regards,
Pinal
17 years ago
JSF
Hello All,

I don't know what I am doing wrong here but for some reason, I am not able to list Table and a Calendar on the same row (next to each other). I have created a outer table using dataTable to have two columns (one for Table and the other for Calendar). Any input will be appreciated.

FYI: I am using Facelets and MyFaces.

Thanks,
Pinal

<!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"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk">

<ui:composition template="/WEB-INF/layout/basic_layout.xhtml">
<ui:define name="content"><h:form id="foodForm">
<t:dataTable id="outerTable" border="10">
<t:column>
<t:dataTable id="foodTable" border="1"
value="#{foodBean.foodTableInfo}" var="food" rendered="true">
<t:column>
<f:facet name="header">
<t:outputText value="Item" id="h1" />
</f:facet>
<t:outputText value="#{food.item}"></t:outputText>
</t:column>
<t:column>
<f:facet name="header">
<t:outputText value="Calories" id="h2" />
</f:facet>
<t:outputText value="#{food.calories}"></t:outputText>
</t:column>
<t:column>
<f:facet name="header">
<t:outputText value="Fat(Calories)" id="h2" />
</f:facet>
<t:outputText value="#{food.fatCalories}"></t:outputText>
</t:column>
<t:column>
<f:facet name="header">
<t:outputText value="Portion" id="h2" />
</f:facet>
<t:outputText value="#{food.portion}"></t:outputText>
</t:column>
</t:dataTable>
</t:column>
<t:column>
<t:inputCalendar currentDayCellClass="currentDayCell"
dayCellClass="dayCell"></t:inputCalendar>
</t:column>
</t:dataTable>
</h:form></ui:define>
</ui:composition>
</html>
17 years ago
JSF