Win a copy of Rust Web Development this week in the Other Languages forum!

Milan Mendpara

Greenhorn
+ Follow
since May 10, 2011
Milan likes ...
Netbeans IDE PHP Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Milan Mendpara

i'm using ajax in almost every jsf page ...
i found it very useful ..

but i wondering whether excessive use of f:ajax is good programming attitude or not ?
can you please tell me any drawbacks of f:ajax ? in-case of project maintenance is it good ?


10 years ago
JSF
it might work for you by casting it to GregorianCalendar .........

<ace:dateTimeEntry value="#{backBean.urDate}">
<f:convertDateTime dateStyle="short" pattern="MM/dd/yyyy" type="date" />
</ace:dateTimeEntry>


Calendar cal = Calendar.getInstance();
cal.setTime(urDate);
XMLGregorianCalendar xcal = DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar) cal);
obj.setDate(xcal);
// your code
10 years ago
JSF
do something like this :

<t:inputFileUpload id="fileupload" value="#{uploadBean.ufile}" />

import org.apache.commons.io.FilenameUtils;
import org.apache.myfaces.custom.fileupload.UploadedFile;

public class UploadBean {
UploadedFile Ufile;

public String doUpload() {
String prefix = FilenameUtils.getBaseName(Ufile.getName()); // returns the file name
String suffix = FilenameUtils.getExtension(Ufile.getName()); // returns the extension

if(suffix.equals("zip")
// do your upload code
}
}

i hope it will work for you acoording to your requirement ....
10 years ago
JSF
hi !

i've set pagination in ajax with four command button like first,next,previous,last.
it works fine for the first(any among four) button that i have pressed ....... all the subsequent click on that button , ajax listener method is fired ...
but other button's listener method is not fired then onwards

<h:form >
<h:datatable id=myDatatable >
// some code
</h:datatable>
<h:commandButton id="btnFirst" value="First" >
<f:ajax execute="@form" event="action" render="myDatatable hdnPage" listener="#{zoneBean.first}" />
</h:commandButton>
<h:commandButton id="btnPrevious" value="Previous" >
<f:ajax execute="@form" event="action" render="myDatatable hdnPage" listener="#{zoneBean.previous}"/>
</h:commandButton>
<h:commandButton id="btnNext" value="Next" >
<f:ajax execute="@form" event="action" render="myDatatable hdnPage" listener="#{zoneBean.next} />
</h:commandButton>
<h:commandButton id="btnLast" value="Last" >
<f:ajax execute="@form" event="action" render="myDatatable hdnPage" listener="#{zoneBean.last}" />
</h:commandButton>

<h:inputHidden id="hdnPage" value="#{zoneBean.page}" />
</h:form>

// sample of managed bin

// bean scope : requestScope

public void next(AjaxBehaviourEvent e) {
page+=1;
zoneList = port.getAllZones().subList(page * pageRows, page * pageRows + pageRows);
}

i hope you understand my problem .. . so any idea how can i call more than one listener method for the JSF components ?

thanks in advance !!!

10 years ago
JSF

i guess browser is not set as default ...

make sure that your browser is set as default by configure it in your development tool (IDE) ......


10 years ago
JSF
i'm facing the same problem ...

i don't know whether it is proper way to do the things or not

but i've use the tomahawk.jar of tomahawk12-1.1.10 and other dependencies(.jars) from tomahawk20-1.1.10 then everything is working fine
for me and components are render perfectly ......
10 years ago
JSF
I have a page(say A.jsf) from which a managed bean action method is called then it navigate to another jsf page(lsay B.jsf) along with one object.now again when i do some action on that page(B.jsf) the object got null reference. my bean scope is ReuestScoped........
<f:setPropertyActionListener target="#{zoneBean.zoneID}" value="#{row.zoneId}" />

so how can maintain the reference of that object ???

in A.jsf i'm doing something like this ..

<h:commandLink value="Edit" action="#{zoneBean.edit}" >
<f:setPropertyActionListener target="#{zoneBean.zoneObj}" value="#{row}" />
</h:commandLink>

thanks in advance ..
10 years ago
JSF