use of javax.servlet.jsp.JspWriter in project head by mifos.
the class MifosImageTag method doStartTag.
/**
* Function to render the tag
*
* @throws JspException
*/
@Override
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
ResourceBundle resource = getResourceBundle();
path = resource.getString(getId());
try {
out.println(render());
} catch (IOException e) {
e.printStackTrace();
}
return SKIP_BODY;
}
use of javax.servlet.jsp.JspWriter in project jodd by oblac.
the class UrlTag method doTag.
@Override
public void doTag() throws JspException {
PageContext pageContext = (PageContext) getJspContext();
URLCoder.Builder builder = URLCoder.build(baseUrl);
for (int i = 0; i < attrs.size(); i += 2) {
builder.queryParam(attrs.get(i), attrs.get(i + 1));
}
if (var == null) {
JspWriter out = pageContext.getOut();
try {
out.print(builder.toString());
} catch (IOException ioex) {
// ignore
}
} else {
pageContext.setAttribute(var, builder.toString());
}
}
use of javax.servlet.jsp.JspWriter in project jstorm by alibaba.
the class ErrorTag method doTag.
@Override
public void doTag() throws JspException {
JspWriter out = getJspContext().getOut();
try {
StringBuilder sb = new StringBuilder();
if (e == null || e.size() == 0) {
// sb.append("<span class='glyphicon glyphicon-ok-sign ok-msg'></span>");
// sb.append("<span class='ok-msg'>N</span>");
} else {
String gly_cls = "glyphicon-remove-sign";
String a_cls = "error-msg";
String err_mgs = getErrorMsg();
if (isWarning) {
gly_cls = "glyphicon-exclamation-sign";
a_cls = "warning-msg";
}
String err_content = getErrorContent();
sb.append(String.format("<span tabindex='0' class='tip-msg pop %s'>%s</span>", a_cls, err_mgs));
sb.append(String.format("<div class='hidden pop-content'>%s</div>", err_content));
}
out.write(sb.toString());
} catch (IOException e) {
throw new JspException("Error: " + e.getMessage());
}
}
use of javax.servlet.jsp.JspWriter in project jstorm by alibaba.
the class StatusTag method doTag.
@Override
public void doTag() throws JspException {
JspWriter out = getJspContext().getOut();
try {
String label = "default";
switch(status.toLowerCase()) {
case STARTING:
label = "primary";
break;
case ACTIVE:
label = "success";
break;
case KILLED:
label = "warning";
break;
case INACTIVE:
label = "default";
break;
case REBALANCING:
label = "info";
break;
}
String result = String.format("<span class='label label-%s'>%s</span>", label, status);
out.write(result);
} catch (IOException e) {
throw new JspException("Error: " + e.getMessage());
}
}
use of javax.servlet.jsp.JspWriter in project OpenClinica by OpenClinica.
the class PrintTableTag method doTag.
/**
* This JSP Tag API method creates a instance of PrintHorizontalFormBuilder,
* then generates that class's XHTML output into the web page. The tag shows
* all sections of a CRF.
*
* @throws JspException
* @throws IOException
*/
@Override
public void doTag() throws JspException, IOException {
JspContext context = getJspContext();
JspWriter tagWriter = context.getOut();
// This request attribute is generated by the PrintCRf or PrintDataEntry
// servlets
List<DisplaySectionBean> listOfDisplayBeans = (ArrayList) context.findAttribute("listOfDisplaySectionBeans");
StudyBean studyBean = (StudyBean) context.findAttribute("study");
// EventCRFBean
EventCRFBean eventCRFBean = (EventCRFBean) context.findAttribute("EventCRFBean");
String isInternetExplorer = (String) context.findAttribute("isInternetExplorer");
if (listOfDisplayBeans != null) {
PrintHorizontalFormBuilder printFormBuilder = new PrintHorizontalFormBuilder();
// Provide the form-building code with the list of display section
// beans
printFormBuilder.setDisplaySectionBeans(listOfDisplayBeans);
// The body content of the tag contains 'true' or 'false', depending
// on whether the
// printed CRF involves data entry (and possible saved data) or not.
JspFragment fragment = this.getJspBody();
Writer stringWriter = new StringWriter();
fragment.invoke(stringWriter);
if ("true".equalsIgnoreCase(stringWriter.toString())) {
printFormBuilder.setInvolvesDataEntry(true);
}
printFormBuilder.setEventCRFbean(eventCRFBean);
if ("true".equalsIgnoreCase(isInternetExplorer)) {
printFormBuilder.setInternetExplorer(true);
}
if (studyBean != null) {
printFormBuilder.setStudyBean(studyBean);
}
if ("true".equalsIgnoreCase(stringWriter.toString())) {
tagWriter.println(printFormBuilder.createMarkup());
} else
tagWriter.println(printFormBuilder.createMarkupNoDE());
} else {
tagWriter.println("The application could not generate the markup for the printable form.<br />" + "This error may have been caused by the altering of the web page's URL; the URL needs " + "an 'id' or an 'ecId' value in its query string at the URL end.");
}
}
Aggregations