How to set an object in attribute using tags

Hello.
I know you can do this <% request.setAttribute("someName", Object); %>
But i am wondering if there is a jsp , jstl tag which can do the same thing? Also where I can give the scope.
I would like to do something like this <jsp:someTag name="someName" value=${variable} scope="request" />
Thanks in advance.

I think you can use
<c:set var="articleList" value="${advertises}" scope="session" />But this doesnt work. Any ideas?

Similar Messages

  • How to set a object value bound to a session to JavaScript variable

    In a JSP, I store an object value in a HttpSession and I also write a Javascript function to display something on the screen. I need to use the Javascript function to display the object value which is stored in the session. How to set the object value to variable of the JavaScript function. Thanks.

    I write a class JavaScriptHelper to convert the object value to variable of the JavaScript;
    1.get the data to a javabean from database;
    2.convert the data to variable of the JavaScript as a String ;
    3.store the object in a HttpSession or Httprequest ;
    4.use in Jsp get the String (variable of the JavaScript )
    YourBean bean = (YourBean) request.getAttribute("model");
         if (bean != null) out.println(bean .getJsCode())
    convert function,(this is only for the matrix):
    public static String formatJsCode(Vector vector) {
    String sJsCode = "";
    //get js head
    sJsCode = getJsHeader();
    //define js array;
    sJsCode += "var data=new Array();\n";
    Vector v = null;
    String sTemp = "", sLine = "";
    for (int i = 0; i < vector.size(); i++) {
    v = (Vector) vector.get(i);
    sLine = "";
    for (int j = 0; j < v.size(); j++) {
    sTemp = (String) v.get(j);
    //replace " to \"
    sTemp = sTemp.replaceAll("\"", "\\\\\\\"");
    //escape Html Tag
    //sTemp = StringUtil.escapeHTMLTags(sTemp);
    //replace \r\n to <br>
    sTemp = sTemp.replaceAll("\r\n", "<br>");
    if (j != 0)
    sLine += ",";
    sLine += "\"" + sTemp + "\"";
    sJsCode += "data[" + i + "]=new Array(" + sLine + ");\n";
    //get js foot
    sJsCode += getJsFooter();
    return sJsCode;
    public static String getJsHeader(){
    return "<script language=\"JavaScript\">";
    public static String getJsFooter(){
    return "</script>";
    }

  • How to set a Object value by JDI

    How to set a Object value using JDI?
    For example:
    class User{
      private String name;
      private String id;
    set and get method;
    public static void main(String[] args) throws Exception {
            VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
            List<AttachingConnector> connectors = vmm.attachingConnectors();
            SocketAttachingConnector sac = null;
            for (AttachingConnector ac : connectors) {
                if (ac instanceof SocketAttachingConnector) {
                    sac = (SocketAttachingConnector) ac;
                    break;
            if (sac == null) {
                System.out.println("JDI error");
                return;
            Map<String, Connector.Argument> arguments = sac.defaultArguments();
            Connector.Argument hostArg = arguments.get("hostname");
            Connector.Argument portArg = arguments.get("port");
            hostArg.setValue(HOST);
            portArg.setValue(String.valueOf(PORT));
            vmMachine = sac.attach(arguments);
            List<ReferenceType> classesByName = vmMachine.classesByName(CLSNAME);
            if (classesByName == null || classesByName.size() == 0) {
                System.out.println("No class found");
                return;
            ReferenceType rt = classesByName.get(0);
            List<Method> methodsByName = rt.methodsByName(METHODNAME);
            if (methodsByName == null || methodsByName.size() == 0) {
                System.out.println("No method found");
                return;
            Method method = methodsByName.get(0);
    I will connect to server and monitor the remote server JVM , There is a object of User, I want to change its value by the Java Debugger Interface by client.
    so how to set its value by the client, and I can not got the User bean at client.
    I know the basic type filed value changed as follows:
    Value newValue = vmMachine.mirrorOf("change var value");// this field is a string.
    stackFrame.thisObject().setValue(field, newValue);
    But a Object , how can I change its value.
    Thanks Advanced.

    ObjectReference.setValue() is the method for chaining the value of an Object's field. First you need to find the specific Object you want to change, though.
    /Staffan

  • How to Select Members Based on Attributes using Excel VBA

    Hi there,Does anyone know how to select members based on attributes using Excel VBA?I don't seem to be able to find macros or functions to do that.Panda

    you can use the Range or the Cells objects to get a reference to your range values
    in this sample the data is on A1 to B5
    Dim lineList(4)
    lineList(0) = Array(Cells(1, 1).Value, Cells(1, 2).Value)
    lineList(1) = Array(Cells(2, 1).Value, Cells(2, 2).Value)
    lineList(2) = Array(Cells(3, 1).Value, Cells(3, 2).Value)
    lineList(3) = Array(Cells(4, 1).Value, Cells(4, 2).Value)
    lineList(4) = Array(Cells(5, 1).Value, Cells(5, 2).Value)

  • I cannot figure out how to set my apple id to use: itunes (two of accounts), apps store and Itunes store. How do I make one password that will be recognixed by all these devices?

    I cannot figure out how to set my apple id to use: itunes (two of accounts), apps store and itunes store. How do I make one password that will be recognized by all these devices? My apple id is constantly not working.

    Hi Lrwill,
    If the apps that are on your son's iPad were purchased under his Dad's Apple ID, then signing your Apple ID onto the iPad will not help you with updating those apps.
    Also, if the iPad was sync'd with his Dad's iTunes library, then hooking it up to your computer/iTunes library, will require you to reset the iPad, and everything that was loaded under the other Library and Apple ID will be wiped out.
    Can you provide a little more info about what was set up under which Apple ID and what iTunes library the iPad was sync'd with?
    Cheers,
    GB

  • How to set Border in the Excel using UTL_FILE ?

    Hi all,
    Any one aware of
    How to set Border in the Excel using UTL_FILE ?
    Am doing excel creation from a stored procedure.
    Thanks
    Dora

    Hello Dora,
    if you need more than simple csv: at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the package behind the second link supports defining your own formats (and has a tutorial how to do it).
    Regards
    Marcus

  • How to set the full screen mode using setClip method

    hi all,
    how to set the full screen mode using setClip in that softkeys should not be used insteat on that need to create a own softkeys using commands.
    thanks & regards
    Bala.

    In CS5 there are changes made to how the screen mode is reported. In CS3-CS5 the screen mode has a corresponding number. So for instance if the ScreenMode is set to "Preview Off" and you ask indesign CS3 or CS4 to display the screen mode, it will report "1936552047", while in CS5 it will report "PREVIEW_OFF".
    try executing this simple command in respectively CS3, CS4 and CS5 and you will see what I am talking about:
    alert(app.activeWindow.screenMode);
    there is no difference if you do:
    alert(app.activeDocument.layoutWindows[0].screenMode);
    The CS5 solution is rather awkward to work with, unless I am missing something? PREVIEW_OFF is not a string, nor is it a number.
    Example -  doing:
    myScreenMode=app.activeDocument.layoutWindows[0].screenMode;
    and then trying to reset screenMode by something like:
    app.activeDocument.layoutWindows[0].screenMode= myScreenMode
    does not work in CS5 of course. It will throw an error. Neither will this line work:
    app.activeDocument.layoutWindows[0].screenMode=ScreenModeOptions.myScreenMode;
    Any way of working around this?

  • How to Set "DateOnly" property in DateTimeControl using Javascript.

    How to Set "DateOnly" property in DateTimeControl using JavaScript.

    Is there any specific reason you want to set it through JavaScript ? You can directly set the DateOnly property in the markup itself.
    <SharePoint:DateTimeControl runat=server id="dtControl" DateOnly="true"></SharePoint:DateTimeControl>
    Please can you elaborate on what exactly is the requirement for setting this through javascript?
    Geetanjali Arora | My blogs |

  • How to set which User Profile attribute is used for email messages?

    I am having a problem setting up User Profiles in SharePoint 2013. I have users that are both (1) Active Directory users authenticated using Windows Authentication, and (2) Active Directory users, existing in another distinct OU, authenticated via ADFS (active
    directory federation services).
    My problem is with the ADFS users. I want to have the users unique id be their logon email account ([email protected]), but want to populate their work email attribute with their "actual" or real email account.
    If I have an OU (External Users) and within that OU (XYZ Company Users), AND my domain is contoso.com, then I want to add a user such that they have a unique id in active directory ([email protected], but want their email address to be whatever
    it is (I.e. [email protected]).
    MY PROBLEM: I can setup the User Profile Synchronization service to map the properties perfectly, but when I I try to add/share a user in a SharePoint site, the user's account email ([email protected] is sent the message, not their "Work Email"
    ([email protected]).
    QUESTION: How do I get SharePoint to use the "Work Email" attribute (NOT the account email) of a User Profile when sending email messages?

    Okay, within Active Directory, the user's email IS set to
    [email protected] The "unique value" (Using the account logon name) works just fine. The problem is SharePoint. When I logon with another account and choose to share a site with this particular test user, the Email for sharing the site is sent to
    [email protected] (the account logon name), not
    [email protected] (the user's email address)
    How do I get SharePoint to actually use the email address of an AD user, and not use the account logon name when sending notifications?

  • How to set permissions IN Open Directory USING Open Directory groups?

    Hi all,
    Apologies if I've missed this but have been searching for two days trying to figure out how to delegate permissions within the OD to a number of different OD groups and i can't seem to find any way to do this either at the command line or with WGM.
    Examples: an OD group containing those who will manage the full directory need to have permissions on all containers, child objects, and their attributes in the directory. For this one in particular I seem to be able to nest a group in the default Admin group, but this isn't really what i'm after. I need to create OD groups with the ability only to manipulate objects of class apple-computer and similarly, apple-user (really all inetOrgPerson objects). In a nutshell: how do i set permissions on specific attributes or object classes using OD groups?
    thanks for any pointers...
    -andrew

    I think i just answered my own question: Open Directory is OpenLDAP. slapd is all i need.

  • It seems you cannot clone objects with attributes using lazy loading in JPA

    I have an entity with an attribute using lazy loading:
    @Entity
    public class B {
    @ManyToOne(fetch=FetchType.LAZY)
    private A a;
    @Entity
    public class A {
    Assume the following code:
    A a1 = new A();
    A a2 = new A();
    B b1 = EntityManager.find(B.class, ...);
    b1.setA(a1);
    B b2 = b1.clone();
    b2.setA(a2);
    Now with lazy loading enabled I get b1.getA() == a2 instead of b1.getA() == a1. Moreover, the debugger displays the same value holder in b1 and b2 for the attribute a. It appears as if cloning does not make a (deep) copy of the value holder managing the attribute a.
    How can I create a copy b2 of b1, such that the value holder managing a in b1 is a different object as the value holder managing a in b2?
    Thanks, Thomas.

    I have filed a bug to have this addressed in Oracle TopLink 11gR1. I would recommend you file a bug against TopLink Essentials in GlassFish or if you have a support contract report the issue to metalink to have the issue resolved.
    If this is urgent I did try fixing the issue with a small helper method using some reflection. This method is simplified through its throwing of Exception. If you wish to use something like this I would recommend proper error handling.
         * Helper method for cloning an entity and fixing the woven value-holders to
         * complete a proper shallow cloning.
        public static Employee clone(Employee entity) throws Exception {
           Employee clone = entity.clone();
           // Now fix the cloned ValueHolder references
           Field[] fields = entity.getClass().getDeclaredFields();
           for (int index = 0; index < fields.length; index++) {
               Field field = fields[index];
               if (field.getName().startsWith("_toplink_")) {
                   field.setAccessible(true);
                   ValueHolderInterface vhi = (ValueHolderInterface)field.get(entity);
                   Object value = vhi.isInstantiated() ? vhi.getValue() : null;
                   field.set(clone, new ValueHolder(value));
           return clone;
        }Doug

  • How to set Principal object?

    Hello,
    I have two web applications. The "app1" is the one we are developing and retrieving the Principal object. The "app2" is a black box web application which we have no way to modify. We can only add parameters in web.xml. The business flow is that once the Principal object is retrieved in "app1", the "app1" calls "app2". The "app2" is looking for User_Principal object. The document says "USER_PRINCIPAL = (The user name is retrieved from a call to getUserPrincipal().getName() on the HttpServletRequest object for the current request in a servlet or JSP)". If I understand this correctly, the "app2" is going to look for "HttpServletRequest". How can the "app1" set Principal object so that "app2" can retrieve it from "HttpServletRequest"? As far as I know there is not "setUserPrincipal()" method in "HttpServletRequest". So the app1 cannot use "HttpServletRequest".
    Thanks in advance,
    Mustafa

    The UserPrinciple is set by the server after the user has been successfully authenticated. You should force the user to login to the second application using the <security-constrain> entry in web.xml. If your user has already been authenticated in your first application than make sure that you have the Realm the user is authenticated to available for both web apps.

  • How to set  an object in request scope in  a jsp uysing  jstl

    I usally use scriptlet in jsp to set an object in request is
    there a way to do this using jstl
    instead of this
    <%request.setAttribute("test",myObject);%> I want to use tag ?

    The <c:set> tag should be useful...
    Of course if you can access it as a JSTL variable it IS already an attribute in scope.

  • Alignment tool - how to set reference object?

    I am new to Flash but have used Illustrator and InDesign for years. I am wondering if someone can explain how to set the reference object by which all other objects are aligned; e.g. Illustrator ->select all objects then a second click on the reference object and all other objects take their cue.
    InDesign you lock the reference object and that determines the rest.
    In Flash it seems that either both objects move or the one that I wish to remain in position jumps rather than the other way around.
    Thanks

    I don't know if you can set a reference object in Flash.  I have always just followed the general rule of aligning into the direction where the alignment basis would not move... meaning if I am aligning to the left, then the leftmost item I would select would be the reference, and if need be I would move other objects to the right of it first.

  • How To Set Up Airport Express To Use With iPad2 For My Needs ?

    On the advice of several people in a audio forum, I just purchase an Apple Airport Express. I will be using it with my new iPad 2. What I need to accomplish is using my iPad2 to stream subscription based music from the internet to the Airport Express, and for the Airport Express to connect via toslink cable to the DAC in my audio system.
    What I am not sure about is how to set up my Airport Express to accomplish this. I do have a wireless network in my home, but wish to keep the wireless connectivity between the Airport Express and the iPad2 separate from it.
    I would greatly appreciate any assistance with this. Thanks.

    Deggie, firstly, thank you for your attempt to help. I greatly appreciate it. I connected it via the ethernet cable to the router since when I reconfigured the Airport Express adding it to my existing wireless system, the iPad could not connect to anything until I unplugged the Airport Express. I set it up for an ethernet connection to my router based on that experience.
    Either the Ipad does not seem able to send anything to the Airport Express, or the AEX is not passing anything on. I also tried streaming a song stored on the iPad 2 to the AEX with no result, so it is not an issue with the subscription channel.
    I don't own a miniplug cable of any sort for further testing, but the toslink cable is brand new, and was literally taken out of its package and plugged in, so I feel it extremely unlikely it is the issue. I've also tested it in three inputs on the DAC, so it is definitely not an issue with it.
    I have a question though. You said "when you start your subscription and go to Airplay, does the iPad see the AEX?" You may be on to something there. How do I "go to Airplay" I thought it was just automatic?  Also, how do I "select it"? This may be the problem.

Maybe you are looking for

  • Engraving

    Today i want to purchace Ipad mini for gift, but i saw no option for engraving in uae on ine store thanks shinoy

  • Installing Java 6u10 beta on an openSUSE linux computer

    Alright, I hope I posted this in the right spot. I recently started running openSUSE and am clueless as to how to run the package manager for it. So I decided to download the Java 6u10 JDK and install it manually. However, I'm not quite sure how to d

  • Ipad2 pic problem

    Why do small blue boxes with a question mark inside show up where pictures and video should in safari and some apps?

  • Color prints in PSE 9 not accurate.

    Hello, I've been having trouble printing color prints with PSE 9.  They appear kind of pale or less vivid (unacceptably so), the colors are just not as they appear on my monitor.  I'm using an Epson R2880, iMac 10.6.8.   It prints b&w beautifully.  I

  • How do I fix this? "the iphone can not be synced an unknown error occered. (1140)"

    after updating my iphone 4 to ios 5 i can not sync my iphone, im getting this message: "the iphone can not be synced an unknown error occered. (1140)" also when ever i try to open any applications that dont already come on the iphone they dont open,