IsUserInRole() - return boolean from custom tag?

Hello
Im writing some custom tags extending TagSupport. At the moment my tags just create some collection and put it in the page scope for the jsp to access. (see example below)
I have a tag however that I would like to return a boolean for. This is specifically for checking isUserInRole();
I cant quite get my head around the idea of manipulating the page body or not and how this impacts writing the custom tags. If I want to return some value directly from my tag ie. a boolean value from isUserInRole(); is this manipulating the page body?
Is TagSupport the correct class to extend if I want to return a boolean value from my tag call.
Id appreciate any advice.
Thanks
Jon
public class refSuppliersTag extends TagSupport {
public int doStartTag() throws JspException {
try {
HashMap supplierMap = new HashMap();
supplierMap = (HashMap) referenceData.getSuppliers();
pageContext.setAttribute("suppliers", supplierMap);
} catch (Exception e) {
throw new JspException(e.toString());
return EVAL_PAGE;
------------------------------------------

this is one way of designing your tag:
In JSTL
<my:login var="isAdminRole" role="admin"/>
<!-- test for it -->
<c:if test="${isAdminRole}">
yeah, you are admin user!
</c:if>
In Java
boolean isLoggedin = login();
session.setAttribute(var,isLoggedin);
// where "var" is a String tag attribute!
//...put the "boolean" result in "var", which is a session's parameter, request's parameter or whatever!
by Avatar Ng
[blog http://avatar21.superihost.com/ ]
Message was edited by:
Avatar_Ng

Similar Messages

  • Finding message bundle from custom tag

    I have a JSP page which has a <fmt:setBundle> to set the translations bundle. It also has a tag which I handle using a custom tag handler based on TagSupport. One of the attributes to this tag is a string which I need to look up in the message bundle, so I need to find the right message bundle as set at the top of the JSP page.
    So putting the question succinctly, how, from custom tag handler code, do I find the message bundle the page is using?

    So putting the question succinctly, how, from custom tag handler code, do I find the message bundle the page is using? To answer your question:
    The <fmt:setBundle> tag (according to the documentation:
    Creates an i18n localization context and stores it in the scoped variable or the
    javax.servlet.jsp.jstl.fmt.localizationContext configuration variableSo you can look up that configuration variable, and use its information to obtain the resource bundle name, or the Localization object which wraps the bundle.
    Of course, thats the hard way...
    You see the friendly folks who wrote the JSTL knew that there would be people who would want to do this.
    So they wrote a helper class for us: [javax.servlet.jsp.jstl.fmt.LocaleSupport|http://java.sun.com/products/jsp/jstl/1.1/docs/api/javax/servlet/jsp/jstl/fmt/LocaleSupport.html]
    A better question is actually:
    How do I look up a message in the bundle set by JSTL <fmt:setBundle> when I am in a custom tag handler?The answer is:
    LocaleSupport.getLocalizedMessage(pageContext, key)Its all in their (relatively readable) [JSTL specification|http://java.sun.com/products/jsp/jstl/reference/api/index.html]
    cheers,
    evnafets

  • Passing Values back from Custom Tag

    I'm using custom tags, and I'm trying to pass back values to the JSP page from a tag which is iterating over values it gets from an Array. But for some reason I can't access the values.
    Here is the Tag:
    public class MemberHelper extends TagSupport implements IterationTag {
        private Iterator iterator;
        protected Tag parent;
        protected PageContext pageContext;
        public MemberHelper() {
            super();
        public void otherDoStartTagOperations() { 
            sfmember_prop_desc desc = new sfmember_prop_desc();
         ArrayList allt = new ArrayList();
         try {
                 allt = desc.GetAllCustom();
         } catch (java.sql.SQLException ex) {}
            if(allt.size() > 0)
             iterator = allt.iterator();

        public void otherDoEndTagOperations()  {
        public boolean shouldEvaluateRestOfPageAfterEndTag()  {
            return true;
        public int doStartTag() throws JspException, JspException {
           otherDoStartTagOperations();
           if (theBodyShouldBeEvaluated()) {
              return EVAL_BODY_INCLUDE;
           } else {
              return SKIP_BODY;
         public int doEndTag() throws JspException, JspException {
           otherDoEndTagOperations();
           if (shouldEvaluateRestOfPageAfterEndTag()) {
              return EVAL_PAGE;
           } else {
              return SKIP_PAGE;
        public int doAfterBody() throws JspException {
           if (theBodyShouldBeEvaluatedAgain()) {
              return EVAL_BODY_AGAIN;
           } else {
              return SKIP_BODY;

  • How to map sales return process from customer to mfg plant without Depot??

    Dear All
    we have a Mfg plant (mfg1) & having  seven Depot.
    regular process of STO DEPOT process
    ME21N-Purchase order STO
    VL10B - Replenishment delivery
    VL02N - PGI
    VF01- Proforma invoice
    J1IIN - Excise invoice
    MIGO - Goods Receipt
    J1IG - Excise Capture
    VA01 - sale order
    VL01N - Out bond Delivery
    J1IJ - Excise invoice
    VF01 - commercial invoice.
    J1IDEPOTSTOCK - RG23D Report.
    In Case of rejection the Sales Return is directly delivered from customer to 
    manufacturing Plant,In this process depot is not directly  billed. The transaction is
    done between customer to manufacturing plant.our question is how to MAP above scenario in sap
    (currently all this activity is done in excel sheet ) please suggest any proper method....
    Regards
    Sachin

    Hi Laksmipati,
    Thanks for your reply, however one of my clients requirment is that the returns delivery will be made directly to the mfg plant and not to the depot plant. In this case the excise calculation is going HAYWAYAA......I understand that it will make sense if the returns is 1st made to the depot and then to the mgf plant. The system wont allow me to do a returns with refernece to the invoice since it has been made from the depot to the plant. Also this will create a problem while doing A PGR. I will be grateful if you could comment on the same.
    Thanks
    Sachin

  • Return Delivery from Customer

    We are receving the delivery from customer and we are using return sales order and inbound delivery.
    Which movement type we should use to get the part back from customer.
    457:-to stock in quality inspection stock
    or
    655:-Quality inspection stock
    and what movement type I should use to move part from there to block or scarp ?
    Thanks

    Hi,
    Depending on how Customizing for Sales is configured (the movement type is configured in the step Define Schedule Line Category), the delivery is posted to the following stock:
    Blocked stock returns (non-valuated, not unrestricted-use) (movement type 651)
    Unrestricted-use stock (movement type 653)
    Quality inspection stock (movement type 655)
    Blocked stock (movement type 657)
    So if you want to take it into blcked stock then use movement type 657.
    please go through following link as well. it will help you.
    http://help.sap.com/saphelp_470/helpdata/en/a5/63360a43a211d189410000e829fbbd/frameset.htm
    Hope it will help u.
    Deepak

  • Writing Cookie from Custom Tag

    Hi Everyone.
    I am attempting to write a cookie from a custom tag with the following code.
    private void writeCookie(){
             Cookie cookie = new Cookie("TEST", "cookie_value_from_tag");
         cookie.setMaxAge(60*60*24*7* 52);
         cookie.setComment("Test_CookieFromCuttomTag");
         cookie.setPath("/student");
         javax.servlet.http.HttpServletResponse resp = (javax.servlet.http.HttpServletResponse)pageContext.getResponse();
         System.out.println("Adding test cookie from CustomTag");
         resp.addCookie(cookie);
         System.out.println("DONE Adding test cookie from CustomTag");
        }The cookie never appears on my machine.
    I see the messages that wrap the resp.addCookie() method
    so I know the code is being called.
    What am I doing Wrong?
    My Browser is set to accept ALL cookies.
    I am using Tomcat 4.1.27
    Any and all help is greatly appreciated
    Sean

    Actually, the cookie is not writing when I am using <jsp:include>
    It works fine when I do not use include
    the jsp I am using to include is
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:registration="urn:jsptld:/WEB-INF/enrollment.tld"
    xmlns:html="urn:jsptld:/WEB-INF/struts-html.tld"
    xmlns:logic="urn:jsptld:/WEB-INF/struts-logic.tld"
    xmlns:bean="urn:jsptld:/WEB-INF/struts-bean.tld"
    xmlns:common="urn:jsptld:/WEB-INF/common.tld"
    version="2.0" >
    <jsp:directive.page language="java" contentType="text/html;charset=UTF-8"/>
    <html  xmlns:jsp="http://java.sun.com/JSP/Page">
      <body>
          <jsp:include flush="true" page="forgotPasswordChallenge.jsp"/>
          <jsp:include flush="true" page="new_forgotPassword.jsp"/>
          <common:validation_message/>
      </body>
    </html>
    </jsp:root>the custom tag is <common:validation_message/>
    Any Ideas on why this is occuring?

  • Trying to get AuthenticationUser from custom tag

    Hello, I'm trying to access the authentication username from a custom tag. The code we're using is this:
    IPTSession session = (IPTSession)GetEnvironment().GetUserSession();
    String authName = session.GetUser().GetAuthenticationUser();
    But we get an exception:
    com.plumtree.server.marshalers.PTException: -2147024891 - Error in function PTUser.GetAuthenticationUser (): -2147024891 - PLUMTREE authentication in use. AuthUser is user name.
    What does this mean? Does anyone know how else to approach this?

    Are you trying to get login name or definition of the user present in user repository ?
    Check these methods: GetUniqueAuthName() or GetLoginName().

  • Vendor Consignment - Returned material from customer directly to consignmen

    Hi,
    I'm working with a consignment vendor process. I'd like to know how should I manage the return from my costumer. I'd like to move this returned material directly to my vendor consignment.
    Is it possible? How can I do it? How affects it to the consignment settlement?
    Points will be given
    Thanks in advance

    Hi Roger,
    We have 2 type of consignment process in SAP.
    1. Vendor consignment (MM process) & 2. Consignment with customer.(SD process)
    If the Customer is returning the item (or consignment item). ... it will be process as normal process...like goods receipt in to inspection ... if it is ok... then again we can move to Consignment ( with customer)...in seperate transaction.
    Hope this is clear.
    REgards
    Anand

  • Regarding return message from custom transaction

    Hello all,
              i have a scenario where i am calling a custom transaction and trying to get return messages, but i am not getting any return message instead i am getting error message in that transaction even if i am using mode 'N' in my call.
            Do my custom transaction need to follow some methodology which will return error message, as messages are returned when standard call transaction is made.
    Thanks
    raju N

    hello abi,
            i am getting a empty message table, thing is that from the custom transaction they are calling other standard transaction and getting error message. if any error occurs they are using 'message id'  syntax and displaying and if any error occurs internally in that transaction they are using 'message e001'. this kind of error messages are returned to my call transaction but the other one is not getting populated.
    Thanks,
    raju N
    Message was edited by:
            krishnam Raju N

  • Process after return invoice from customer

    Dear gurus,
    Would anyone help me on this issue below?
    I created customer orders for one customer in three spesific times. One of these orders is service(no PGI) others are with PGI. Now our client send us one return invoice which includes both service order and material order.
    Can anyone tell me step by step for the next process?
    What must I do?

    Hi,
    Material orders :
    Create a return order based on original invoice for the material orders, than create a return delivery and do the PGR.
    After that create a credit memo wrt return order or return delivery as per your current  settings.
    Service Order
    Create a credit memo directly with reference to original invoice for services or create a return order for services and with reff to order create a credit note .
    HOpe this will help you !!!!
    Regards,
    Krishna O

  • Return results from custom dialog box not visibly updating field value

    I have a form with custom dialog boxes (execDialog) for data entry. The dialog box is being called from the Entry event successfully. I also have it called from the Click event. So, here's what I get:
    1. On entering the field, I get the dialog box pop up, I select a value, it visibly changes the field raw value and leaves focus in the field.
    2. If I exit the field and re-enter, it also works as in point 1 (as expected)
    3. If, while focus is already in the field, I click in the field, I get the dialog box, as expected, but after selecting a value from the dialog, the field raw value DOES NOT VISIBLY change until I exit the field! It's kind of like the click event is working in conjunction with the Exit event. This is totally counter-intuitive for a production form that is being designed for the general populace.
    Anyone had any experience with this?
    Cheers,
    Marty.

    Thom Parker answered this here: http://forums.adobe.com/message/2614570#2614570
    Answer copied below:
    "The problem is that when the focus is on the text box
    it's in edit mode. It's only displaying the value interactively entered by
    the user, or as a consequence of the change event.  What you need to do is
    force the focus off of the text box in code.  You can do a little trick
    where you bounce it to a tiny transparent field, which then bounds the focus
    back so it doesn't look like the focus changed."
    What I ended up doing was calling up the dialog box, then using setfocus with no parameters to remove focus from the field, as follows:
    this.rawValue = this.dialogBoxFunction(this.rawValue); // passing current value so dialog box defaults to that value
    xfa.host.setFocus();
    Cheers,
    Marty.

  • Return from customer movement type

    Hello,
    We use in our system 653 mov.type when we return goods from customer.
    Usually we create the return order with reference to the original customer order and the original customer order is MTO (make to order) . When posting the 653 mov.type the system take the cost of the material (VPRS) from moving average price of unrestricted stock.
    My question is : in cases that my return customer order is with reference to original customer order, is it possible to configure a movement type (or other way) that the system will take the cost from the original customer order and not from the cost in unrestricted stock and in advance it will affect the moving average price ??
    I will try to explain by an example:
    I have in stock 10 pieces each for 5 $,
    My return order has 4 pieces that has cost of 8 $ in the original customer order.
    The system behavior today after returning the stock with 653 mov type:
    I have 14 pieces with cost of 5 $ - no change in moving average price and VPRS cost for profitability analysis  is 5 $
    The desirable behavior according to my expectations:
    I will have 14 pieces with cost of (50+32)/14=5.8 u2013 the moving average will change according to cost in original customer order 8 $ and VPRS cost for profitability analysis is 8$.
    I hope I made my self clear enough
    Regards
    Idit

    Hello Kishore,
    Thanks for your answer.
    I can understand the idea that MAP changes only in case of Purchase of material not at time of sales returns.
    But I want to give you a case that causes problems in our view:
    Most of my sale cases are MTO, that means that I buy for order and therefore my MAP will not be affect.
    Example: my MAP 3 $ I buy to order for 5 $ and when I will do GR it will not affect the MAP (101E)
    When I will return the goods (653) I want that the cost from vendor (5$) will affect the MAP because this was the real cost from my vendor but when I return the stock I return it to unrestricted stock.
    I have cases that I transfer sales order stock to unrestricted stock and the MAP is change according to cost of sales order (411E/412E) u2013 it's the same in my logic - the MAP change according to the real cost from vendor.
    I will be happy to have your response.
    Kind Regards
    Idit

  • Return sales stock from customer

    Dear All
    for Return goods from customer,after posting the return delivery and goods recipet (the stock is posting in to movement type 651)  and not available in the unrestricted use stock, then how to make these stock to use as unrestricted use and saleable to other customers.
    Please give the soluation for this problem, its top urgent.
    Thanks in advance.

    Hi,
    When Cuistomer Return Stocks are processed by default it goes to "Returns Blocked Stock" Not valauated for Movement type 651,
    You can trasnfer post it to Unrestrcited using Mvmt Type 453
    If you want directly into unrestrcited then use 653
    Regards

  • Movements types of the Returns from Customer

    Hi Gurus,
    Currently the Return Process from Customer is done using the movement type 651 that the batch quantity is posted in the Return Status but the finance people cannot see the finance values from this return before the transfer of the status.
    Point 1:
    I was wondering if you could inform me when I execute the movement type 453 that  is transfer from Return status to Unrestricted Status they can see the finance values? Or to solve this point all returns must be done using the movement type 655 where the batch is posted in quality status and the finance people can see the finance values?
    Point 2:
    I am using the tcode MB1B for the movement type 453 to transfer the batch quantity from Return Status to Unrestricted Status but unfortunatelly the batch quantity is being posted for quality status.
    In advance I would like to thank you for your attention. I'd be pleasure if you could give some tips for this process.
    BR
    Valdevair

    Hi,
    Use following procedure:
    Create Return sales order(YERT), Post goods receipt(VL01N) and then post billing wrt sales order(VF01). Unless u create billing FI impact cannot be seen.
    Regds-SRB

  • Inspection lot with stock tab for sale return from customer.

    Dear,
    In our organization there are two scenarios,
    1)     Make to order- Strategy group -20
    2)     Make to stock- Strategy group -10
    I have maintained 05 inspection types in QM view for sale return inspection from customer.
    1) In make to order scenario Inspection lot created with inspection stock tab which is OK.
    2) But in make stock scenario no inspection lot is generated.
        Remember I donu2019t want inspection lot without inspection stock tab as per insp. type-06
    So please suggest me, what can I do for getting inspection lot with stock tab for make to stock scenario.
    Regards
    Shabbir Kureshi

    Hi
    QCC0>Quality inspection>Inspection lot creation>Inspection for shipping>Assign Inspection Lot Origin to Delivery Type-->aganist delivery type Enter 05 inspection lot origine
    Also in OMJJ check whether QM in active for mnt type 651
    Regards
    Sujit

Maybe you are looking for

  • Hp-psc 1317 all-in-one printing problems

    I have a hp psc 1317 printer scanner.  It is connected to my laptop running Windows Vista.  Recently the print quality diminished until now when I print a document it sounds like printing is happening but there is no mark on the paper whatsoever.   T

  • Does it have a feature that supports management with accounts, fixed IP, VLAN ?

    I'm not quite familiar with those advanced features if it does exist as the fact that i've been primarily using cheap and unknown AP products for years :D I'm planning on upgrading my APs for personal reasons. Could anyone tell me does it have a feat

  • Trouble getting internet route table distributet in a VRF

    Hi every one .. I'm have some trouble getting distributed the internet routing table between PE routers ... CE1 og PE1 works fine, BGP routes all internet routes are shown i en route table, but distributing between PE1 and PE2 is now working .. any o

  • Tag without endtag in XSL

    Hi, If I write for exemple <BR></BR> or in my XSL template. The XSL Parser transforms it in <BR> (without the trailing slash). I don't want <BR> but or <BR></BR> as output tag. Any suggestion Thanks Johannes Borch null

  • Can't save itunes library -error (-54)

    I get the following error when I am importing from a retail CD:the itunes music library file cannot be saved. an unknown error occurred (-54) Although all info appears in iTunes fields (name, title, artist,etc, when I attempt to burn, it only burnes