wood burning stoves 2.0*
The moose likes JSF and the fly likes jsp tag lib migration to jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "jsp tag lib migration to jsf" Watch "jsp tag lib migration to jsf" New topic
Author

jsp tag lib migration to jsf

Arun Kathare
Greenhorn

Joined: Oct 02, 2006
Posts: 19
Hi ,
I need to migrate custom tag lib from jsp to jsf I have seen many examples where no additional logic is written . But in my case some additional logic is put in the doStartTag what is the equivalent for the same in JSF.


public int doStartTag() throws JspException {
StringBuffer results = new StringBuffer(20);
JspWriter writer = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) pageContext
.getRequest();
long before = System.currentTimeMillis();

try {
if (id != null && !id.equals("")) {
FieldVO field = CLSDelegate.getFieldInfo(id);
if (field == null) {
results.append("FieldTag: couldn't find field in database");
writer.print(results.toString());
return EVAL_BODY_INCLUDE;
}
String printMode = FacesUtils.getRequestParameter("prnMode");

/** changed by offshore team **/
if (name != null && !name.equals("")) {
//To make the page fit into print page, nowrap removed for print screens
if (("Print").equals(printMode)) {
results.append("<span ");
}else{
results.append("<span nowrap ");
}
if(style!=null && ! style.equals("")){
results.append("style ='" + style + "'");
}

String validationfailure=FacesUtils.getSessionParameter(id);

if(styleClass!= null && !styleClass.equals("")){
if(validationfailure!=null && validationfailure.equals(CLSConstants.ERROR))
{
styleClass="clsErrorTextInvert";
}
results.append(" class='" + styleClass + "'>");
}
else
{
results.append(">");
}
results.append( field.getFieldName() + "</span>");
} /** changed till here **/

// check the help attribute value and display the help image if help is true
if (help != null && help.trim().length() > 0 && help.equals("true")) {

if (field.isHelpflag()) {
// Changed by Ramkumar on 26-Nov-2005 to increase the help window size.
results
.append("<a <br /> + field.getHelpURL() <br /> + rel="nofollow">");
}

}
if (admin != null && !admin.equals("")
&& SecurityAdmin.isAdminUser(request.getSession())) {

results
.append("<a <br /> + ADMIN_URL <br /> + rel="nofollow">");

}
} else {
results.append("FieldTag: field id wasn't passed in");
writer.print(results.toString());
return EVAL_BODY_INCLUDE;
}
writer.print(results.toString());
} catch (Exception e) {
throw new JspException(e.toString());
}
String reqURL = request.getRequestURI().toString();
if(reqURL.indexOf("Report")>=0)
{
logger.debug("Time Taken [FieldTag][" + reqURL+"] :"+ (System.currentTimeMillis()- before));
}

// Continue processing this page
return EVAL_BODY_INCLUDE;
}
 
 
subject: jsp tag lib migration to jsf