Rodney Hirokane

Greenhorn
+ Follow
since Dec 04, 2009
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 Rodney Hirokane

Stefan Frings wrote:The hidden button does not work beause the action handler answers with a page, which is the same page in this case. So the page will get re-loaded and because the onload script clicks the button again, the page gets reloaded in an endless loop.

Sometimes the solution is so easy to oversee it:





This calls the init method when the page gets loaded.

If you use the older JSF 1.2 release, then write #{myBean.init} and name the method getInit().



I could not get this solution to work in my case. I created a web page where the submit button executes myBean.method. I need to eventually remove the Submit button and for myBean.method to be executed when the page is loaded. Here is the code for the submit button

<h:commandButton action="#{agencySecurityProfileBean.submit}" value="Submit" styleClass="button" />

Besides including a hidden command button as listed in the previous posts is there a better alternative to resolving this issue or has anyone gotten the simple solution as quoted in this post to work?

Much appreciated,

Rod
11 years ago
JSF

Tim Holloway wrote:

Rodney Hirokane wrote:

Bear Bibeault wrote:If you are using JSF, then this is in the wrong place. Which is it? JSP or JSF?



JSF using JSP for the web app development but maybe you can help better clarify for me. I thought JSF provided the framework that my JSP pages are developed in. My web page files have a .jsp extension that needs to be compiled and the eventual end product is an .ear that is deployed to the application server. I use JSF tags within my .jsp page and also use both session and backing beans for accessing the database. Isn't the JSP being extended using the JSF tags? For what it is worth my development environment is IBM Rational Software Architect and DB2 and my Application Server is Websphere.

Thanks,

Rod



No. JSF started off being based on JSP, but that was long ago. These days, the ".jsp" files are not compiled to produce servlets like "real" JSPs are. Instead, they're used as templates to be digested into JSF View trees. So a ".jsp" suffix is really an illusion. As of JSF2.0, the preferred mechanism is Facelets, and Facelets resources normally have an extension of ".xhtml", in fact.

All of which provide the primary reasons why scriptlets and JSTL don't work well on JSF "jsp"s.

An additional caveat for WebSphere, BTW. Depending on which version and what service packs are in effect, JSF support is integrated into the WebSphere server itself. That makes some things simpler, but you do have to make sure that the version of WebSphere you're using is sufficiently advanced to support the level of JSF that you're developing in.



Thanks for the clarification.

Rod
11 years ago
JSF

Bear Bibeault wrote:If you are using JSF, then this is in the wrong place. Which is it? JSP or JSF?



JSF using JSP for the web app development but maybe you can help better clarify for me. I thought JSF provided the framework that my JSP pages are developed in. My web page files have a .jsp extension that needs to be compiled and the eventual end product is an .ear that is deployed to the application server. I use JSF tags within my .jsp page and also use both session and backing beans for accessing the database. Isn't the JSP being extended using the JSF tags? For what it is worth my development environment is IBM Rational Software Architect and DB2 and my Application Server is Websphere.

Thanks,

Rod
11 years ago
JSF

Bear Bibeault wrote:You should format the data more appropriately before getting to the JSP.

Seems like a Map might be a good fit.



I have decided to make a format change as you suggested. Not sure what you meant by a Map. I am using JSP and JSF. I looked online but could not find anything relevant at this time.
11 years ago
JSF
Hopefully this is the right forum for this question. I pass a list of data elements to my jsp page in the following format.

DEMO Name
DEMO DOB
DEMO CITIZEN
DESCRIPTOR WEIGHT
DESCRIPTOR HEIGHT
DESCRIPTOR HAIR COLOR

I would like to display this data in the following format

DEMO
NAME
DOB
CITIZEN

DESCRIPTOR
WEIGHT
HEIGHT
HAIR COLOR

Does this need to be done using javascript or could this be done through another technique? Should I manipulate my list to be in some other format? Any suggestions appreciated.

Thank you,

Rod
11 years ago
JSF
Thank you for all who replied. My code now works using setLenient as Rob mentioned.

Rod
13 years ago
I found and reviewed a similar post from 2004 and my code seems to be similar with that found in that post. However, I am not receiving the results that I expected. When I test this code against an invalid time of 02:65:10 it validates it as being 03:05:10 where it increments the hour by 1 and decreases the minutes by 60. Following is my code. Any help is appreciated.

SimpleDateFormat sdf;

if (Pattern.matches(("([0-9]{2}[\\:][0-9]{2}[\\:][0-9]{2})"), fieldValue)) {
sdf = new SimpleDateFormat("HH:mm:ss");
} else if (Pattern.matches(("([0-9]{2}[\\.][0-9]{2}[\\.][0-9]{2})"), fieldValue)) {
sdf = new SimpleDateFormat("HH.mm.ss");
} else if (Pattern.matches(("([0-9]{2}[\\:][0-9]{2})"), fieldValue)) {
sdf = new SimpleDateFormat("HH:mm");
} else if (Pattern.matches(("([0-9]{2}[\\.][0-9]{2})"), fieldValue)) {
sdf = new SimpleDateFormat("HH.mm");
} else if (Pattern.matches(("([0-9]{6})"), fieldValue)) {
sdf = new SimpleDateFormat("HHmmss");
} else if (Pattern.matches(("([0-9]{4})"), fieldValue)) {
sdf = new SimpleDateFormat("HHmm");
} else {
return 3011;
}
try {
Date testTime = sdf.parse(fieldValue);
System.out.println(fieldValue + " " + testTime);
return 0;
} catch (ParseException e) {
e.printStackTrace();
return 3011;
}

Rod
13 years ago