Search in sources :

Example 41 with JspWriter

use of javax.servlet.jsp.JspWriter in project wildfly by wildfly.

the class InternalTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    JspWriter out = getJspContext().getOut();
    out.println("Internal Tag!");
}
Also used : JspWriter(javax.servlet.jsp.JspWriter)

Example 42 with JspWriter

use of javax.servlet.jsp.JspWriter in project OpenClinica by OpenClinica.

the class AlertTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    JspContext context = getJspContext();
    JspWriter tagWriter = context.getOut();
    StringBuilder builder = new StringBuilder("");
    List<String> messages = (ArrayList) context.findAttribute("pageMessages");
    if (messages != null) {
        for (String message : messages) {
            builder.append(message);
            builder.append("<br />");
        }
    }
    tagWriter.println(builder.toString());
}
Also used : JspContext(javax.servlet.jsp.JspContext) ArrayList(java.util.ArrayList) JspWriter(javax.servlet.jsp.JspWriter)

Example 43 with JspWriter

use of javax.servlet.jsp.JspWriter in project OpenClinica by OpenClinica.

the class TableTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    JspContext context = getJspContext();
    JspWriter tagWriter = context.getOut();
    boolean isViewData = datacontext != null && datacontext.equalsIgnoreCase(VIEW_DATA_ENTRY);
    DisplaySectionBean dBean = (DisplaySectionBean) context.findAttribute("section");
    StudyBean studyBean = (StudyBean) context.findAttribute("study");
    // tabId is used to seed the tabindex attributes of the form's input
    // elements,
    // according to the section's tab number
    int tabId;
    // this is for viewDataEntryServlet
    Object tabObject = context.findAttribute("tabId");
    if (tabObject == null) {
        // this is for DataEntryServlet
        tabObject = context.findAttribute("tab");
    }
    if (tabObject == null) {
        tabObject = new Integer("1");
    }
    tabId = new Integer(tabObject.toString());
    if (dBean != null) {
        HorizontalFormBuilder formBuilder = new HorizontalFormBuilder();
        // FormBuilder sets tabindexSeed to 1 in its constructor
        if (tabId > 1)
            formBuilder.setTabindexSeed(tabId);
        formBuilder.setDataEntry(isViewData);
        formBuilder.setEventCRFbean(dBean.getEventCRF());
        formBuilder.setDisplayItemGroups(dBean.getDisplayFormGroups());
        formBuilder.setSectionBean(dBean.getSection());
        if (studyBean != null) {
            formBuilder.setStudyBean(studyBean);
        }
        tagWriter.println(formBuilder.createMarkup());
    } else {
        tagWriter.println("The section bean was not found<br />");
    }
/*
         * FormBuilderTest builder = new FormBuilderTest();
         * tagWriter.println(builder.createTable());
         */
}
Also used : DisplaySectionBean(org.akaza.openclinica.bean.submit.DisplaySectionBean) JspContext(javax.servlet.jsp.JspContext) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) JspWriter(javax.servlet.jsp.JspWriter) HorizontalFormBuilder(org.akaza.openclinica.view.form.HorizontalFormBuilder)

Example 44 with JspWriter

use of javax.servlet.jsp.JspWriter in project adempiere by adempiere.

the class InfoLinkTag method doStartTag.

//	setOneLine
/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    //	creates wsc/wu
    Properties ctx = JSPEnv.getCtx(request);
    WebSessionCtx wsc = WebSessionCtx.get(request);
    //
    HttpSession session = pageContext.getSession();
    WebUser wu = (WebUser) session.getAttribute(WebUser.NAME);
    if (wu != null && wu.isLoggedIn()) {
        if (ctx != null) {
            WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);
            if (info == null || wu.getAD_User_ID() != info.getAD_User_ID()) {
                info = new WebInfo(ctx, wu);
                session.setAttribute(WebInfo.NAME, info);
            }
        }
        //
        //	log.fine("WebUser exists - " + wu);
        //
        JspWriter out = pageContext.getOut();
        HtmlCode html = new HtmlCode();
        //
        if (wu.isCustomer() || wu.isVendor())
            menuBPartner(html, wsc.wstore);
        if (wu.isSalesRep())
            menuSalesRep(html, wsc.wstore);
        if (wu.isEmployee() || wu.isSalesRep())
            menuUser(html, wu.isEmployee(), wsc.wstore);
        menuAll(html, wsc.wstore);
        //
        html.output(out);
    } else {
        if (CLogMgt.isLevelFiner())
            log.fine("No WebUser");
        if (session.getAttribute(WebInfo.NAME) == null)
            session.setAttribute(WebInfo.NAME, WebInfo.getGeneral());
    }
    return (SKIP_BODY);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HtmlCode(org.compiere.util.HtmlCode) HttpSession(javax.servlet.http.HttpSession) WebUser(org.compiere.util.WebUser) Properties(java.util.Properties) WebSessionCtx(org.compiere.util.WebSessionCtx) JspWriter(javax.servlet.jsp.JspWriter) WebInfo(org.compiere.util.WebInfo)

Example 45 with JspWriter

use of javax.servlet.jsp.JspWriter in project adempiere by adempiere.

the class MessageTag method doStartTag.

//	setVar
/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    if (m_txt != null && m_txt.length() > 0) {
        Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
        String msg = Msg.translate(ctx, m_txt);
        log.fine(m_txt + "->" + msg);
        //
        try {
            JspWriter out = pageContext.getOut();
            out.print(msg);
        } catch (Exception e) {
            throw new JspException(e);
        }
    }
    return (SKIP_BODY);
}
Also used : JspException(javax.servlet.jsp.JspException) Properties(java.util.Properties) JspWriter(javax.servlet.jsp.JspWriter) JspException(javax.servlet.jsp.JspException)

Aggregations

JspWriter (javax.servlet.jsp.JspWriter)49 IOException (java.io.IOException)21 JspException (javax.servlet.jsp.JspException)21 HttpServletRequest (javax.servlet.http.HttpServletRequest)9 Properties (java.util.Properties)6 HtmlCode (org.compiere.util.HtmlCode)6 org.apache.ecs.xhtml.select (org.apache.ecs.xhtml.select)5 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)3 List (java.util.List)3 HttpSession (javax.servlet.http.HttpSession)3 JspContext (javax.servlet.jsp.JspContext)3 PageContext (javax.servlet.jsp.PageContext)3 org.apache.ecs.xhtml.option (org.apache.ecs.xhtml.option)3 Element (org.dom4j.Element)3 StringWriter (java.io.StringWriter)2 Collection (java.util.Collection)2 JspTagException (javax.servlet.jsp.JspTagException)2 JspFragment (javax.servlet.jsp.tagext.JspFragment)2 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)2