Search Results

Search found 10804 results on 433 pages for 'attribute keys'.

Page 68/433 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • Checking servlet session attribute value in jsp file

    - by Marta
    I have a no framework java application. It consists of jsp files for view and servlets for the business logic. I must set the user session is the servlet with a firstName parameter. In the jsp file, I need to check if my firstName parameter has a value or not. If the firstName parameter is set, I need to display some html in the jsp file. If it is not set, I need to display different html in the jsp file. Servlet.java: HttpSession session = request.getSession(); session.setAttribute("firstName", customer.getFristName()); String url = "/index.jsp"; RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); header.jsp: // Between the <p> tags bellow I need to put some HTML with the following rules // If firstName exist: Hello ${firstName} <a href="logout.jsp">Log out</a> // Else: <a href="login.jsp">Login</a> or <a href="register.jsp">Register</a> <p class="credentials" id="cr"></p> What would be the best way to do this? Any help is much appreciated! Thank you in advance. -Marta

    Read the article

  • SQLAlchemy: an efficient/better select by primary keys?

    - by hadrien
    Yet another newbie question.. Let's say I have an user table in declarative mode: class User(Base): __tablename__ = 'user' id = Column(u'id', Integer(), primary_key=True) name = Column(u'name', String(50)) When I have a list of users identifiers, I fetch them from db with: user_ids = [1, 2, 3, 4, 5] users = Session.query(User).filter(User.id.in_(user_ids)).all() I dislike using in_ because I think I learned it has bad performance on indexed fields (is that true/false?). Anyway, is there a better way doing that query? Thanks!

    Read the article

  • How to tell Reflectively if an Attribute has a public Setter

    - by DrLazer
    Im saving an object model out to XML but when i load it back in I get exceptions when trying to use PropertyInfo.SetValue() because the property doesn't have a setter just a getter. I want to either not save out the properties that only have getters or figure out on load whether its valid for me to try and set a value or not. Anybody know how to do this Cheers

    Read the article

  • Get parent attribute within new child form?

    - by dannymcc
    I have a simple Rails 3 application and I am trying to create a new record that belongs to it's owner. It's working by passing the id to a hidden field in the new form of the child record. This works well and once the new child form submitted it correctly gets associated in the child/parent relationship. What I am trying to do, is lookup values form the parent within the new child form. The problem is that the child relationship is not yet created. Is there anyway I can use a .where lookup in the view? Or, is there a better way of doing this? At the moment I am passing the animal_id though to the new Claim form and it's inserted into a hidden field labelled animal_id. What I am trying to do: <%= @animal.where(:animal_id => params[:animal_id]).id %> The above would ideally get the animal ID from the soon-to-be-associated animal. Is there any sort of before_filter or anything that could take the passed params from the URL and temporarily create the relationship just for the new form view and then permanently create the relationship once the form is submitted? I've tried adding the following to my Claims controller and then called @animal.AnimalName in the view but I get NoMethodError: before_filter :find_animal protected def find_animal if params[:animal_id] Animal.find(params[:animal_id]) end end The URL of the new claim is correctly showing the animal ID so I'm not sure why it's not finding it: http://localhost:3000/claims/new?animal_id=1 The model relations are as follows: animal has_many claims animal has_one exclusion claim has_one animal exception has_one animal

    Read the article

  • Rails: Link changes one attribute and then goes back

    - by James
    Rails newbie here. I have a list of items which can have a status represented by an integer (right now its just 1=active 0=inactive). What I want is next to each item a link to change the status of that item. So it might look like this: A nice item - Enable Another pretty item - Disable I can't think of how to make the link work. I just want a user to click the link and then the page refreshes and the item get updated. This doesn't work: <%= link_to "Enable", :controller => "items", :action => "update", :status => 1 %>

    Read the article

  • Rails attribute alias

    - by Dr1Ku
    Hi, I was just wondering if it's possible to "rename" an association in Rails. Let's assume : # An ActiveRecord Class named SomeModelASubModel (some_model_a_sub_model.rb) class SomeModelASubModel < ActiveRecord::Base has_many :some_model_a_sub_model_items end # An ActiveRecord Class named SomeModelASubModelItem (some_model_a_sub_model_item.rb) class SomeModelASubModelItem < ActiveRecord::Base belongs_to :some_model_a_sub_model end At this point, calling some_model.items, where some_model is an instance of the SomeModelASubModel Class would trigger an undefined method error. What is the best practice for making this happen though, e.g. : # With a method_alias or something, would it be possible to : some_model = SomeModelASubModel.first # for instance items = some_model.items # For the reason stated, this doesn't work, one has to call : items = some_model.some_model_a_sub_model_items Is such a shorthand possible ? Thank you in advance !

    Read the article

  • vb.net press/release keys

    - by Cyclone
    How can you simulate keypresses and releases? I know you can essentially hit a key with Sendkeys.SendWait, but how can your code press and hold q, for example? Any help is much appreciated! Everything I find keeps pointing me at sendkeys, which is not correct. I essentially wish to be able to call something like press("q") and release("q"). The effect would be the same as physically holding them down. Thanks for your help!

    Read the article

  • Foreign keys and NULL in mySQL

    - by Industrial
    Hi everyone, Can I have a column in my values table (value) referenced as a foreign key to knownValues table, and let it be NULL whenever needed, like in the example: Table: values product type value freevalue 0 1 NULL 100 1 2 NULL 25 3 3 1 NULL Table: types id name prefix 0 length cm 1 weight kg 2 fruit NULL Table: knownValues id Type name 0 2 banana Note: The types in the table values & knownValues are of course referenced into the types table. Thanks!

    Read the article

  • Required attribute HTML5

    - by Joop
    First of all I will explain how I stumbled into this behavior. Within my web application I am using some custom validation for my form fields. Within the same form I have two buttons. One to actually submit the form and the other to cancel/reset the form. Mostly I use Safari as my default browser. Now Safari 5 is out and suddenly my cancel/reset button didn't work anymore. Every time I did hit the reset button the first field in my form did get the focus. However this is the same behavior as my custom form validation. When trying it with another browser everything just worked fine. I had to be a Safari 5 problem. I changed a bit in my Javascript code and I found out that the following line was causing the problem: document.getElementById("somefield").required = true; To be sure that would be really the problem I created a test scenario: <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <form id="someform"> <label>Name:</label>&nbsp;<input type="text" id="name" required="true" /><br/> <label>Car:</label>&nbsp;<input type="text" id="car" required="true" /><br/> <br/> <input type="submit" id="btnsubmit" value="Submit!" /> </form> </body> </html> What I expected would happen did happen. The first field "name" did get the focus automatically. Anyone else stumbled into this?

    Read the article

  • Joining tables with composite keys in a legacy system in hibernate

    - by Steve N
    Hi, I'm currently trying to create a pair of Hibernate annotated classes to load (read only) from a pair of tables in a legacy system. The legacy system uses a consistent (if somewhat dated) approach to keying tables. The tables I'm attempting to map are as follows: Customer CustomerAddress -------------------------- ---------------------------- customerNumber:string (pk) customerNumber:string (pk_1) name:string sequenceNumber:int (pk_2) street:string postalCode:string I've approached this by creating a CustomerAddress class like this: @Entity @Table(name="CustomerAddress") @IdClass(CustomerAddressKey.class) public class CustomerAddress { @Id @AttributeOverrides({ @AttributeOverride(name = "customerNumber", column = @Column(name="customerNumber")), @AttributeOverride(name = "sequenceNumber", column = @Column(name="sequenceNumber")) }) private String customerNumber; private int sequenceNumber; private String name; private String postalCode; ... } Where the CustomerAddressKey class is a simple Serializable object with the two key fields. The Customer object is then defined as: @Entity @Table(name = "Customer") public class Customer { private String customerNumber; private List<CustomerAddress> addresses = new ArrayList<CustomerAddress>(); private String name; ... } So, my question is: how do I express the OneToMany relationship on the Customer table?

    Read the article

  • JQuery setting the selected attribute on a select list

    - by Rupert
    I have the following html <select id="dropdown"> <option>A</option> <option>B</option> <option>C</option> </select> I have the string "B" so I want to set the selected attrribute on it so it will be: <select id="dropdown"> <option>A</option> <option selected="selected">B</option> <option>C</option> </select> How would I do this in JQuery?

    Read the article

  • XSL - Get attribute of previous element

    - by Chris
    In the if block below I want to be also test whether @Timestamp is smaller than the previous Message's timestamp. How can I achieve this? <xsl:for-each select="Message"> <xsl:sort select="position()" data-type="number" order="descending"/> <xsl:variable name="newclass"> <xsl:if test="@Timestamp + 60 &gt; $ctimestamp">new</xsl:if> </xsl:variable> <tr><td class="debugtime"> <xsl:value-of select="@Time"/> </td><td class="{$newclass}"> <xsl:value-of select="node()"/> </td></tr> </xsl:for-each>

    Read the article

  • XSLT apply attribute depending on position

    - by Burt
    I am using XSLT for a website based on the 960 grid css framework. I have columns of divs that span across the page if it is the first div in a row it should have a class first applied, if it is the middle one then no class and if it is the 3rd in the row it should have the class last applied. I am really scratching my head as the best way to go about this any help is appreciated. Below is the structure I want to end up with, the numbers inside the divs represent the position. <div class="container_12"> <div id="main-content" class="alpha grid_12" style="margin-bottom: 20px;"> <div class="grid_4 alpha"> 1 </div> <div class="grid_4 "> 2 </div> <div class="grid_4 omega"> 3 </div> <div class="grid_4 alpha"> 4 </div> </div> </div>

    Read the article

  • What CSS attribute stops my site squidging up?

    - by SLC
    I am looking at a website on the internet with the standard centered box design (the entire site is centered in a box and has a border each side). As you shrink it, the border gets smaller but the content stays the same size. This is fine. However on their site, once you get smaller still, you simply get scrollbars. The content remains untouched. On my site if you do this, things like text and links start to scroll onto multiple lines and the whole site gets broken. How can I keep it the same even when the viewport is small?

    Read the article

  • Securing database keys for client-side processing

    - by danp
    I have a tree of information which is sent to the client in a JSON object. In that object, I don't want to have raw IDs which are coming from the database. I thought of making a hash of the id and a field in the object (title, for example) or a salt, but I'm worried that this might have a serious effect on processing overhead. SELECT * FROM `things` where md5(concat(id,'some salt')) = md5('1some salt'); Is there a standard practice for obscuring IDs in this kind of situation?

    Read the article

  • jquery Iframe src attribute

    - by alex
    Why does x alerts undefined for iframe but works for embed. I'm grabbing the iframe or embed code from a textarea <iframe src="http://www.youtube.com/embed/9kiWvkj2ldWiU?hd=1"></iframe> var textarea = $('#embedModal textarea'), textareaValue = textarea.val(), $embed = $($(textareaValue).find('iframe')), x = $embed.attr('src'); alert(x); //alerts undefined for iframe If you change find('iframe') to find('embed') and you try with the below embed code. then i'm able to get the value of src, but with iframe i get undefined. Seems strange. <embed src="http://www.youtube.com/embed/9kiWvkj2ldWiU?hd=1"></embed>

    Read the article

  • Java xml binding with wrong xmlns attribute name

    - by Tom Brito
    When I use the annotation: @XmlRootElement(name="RootElement", namespace="namespace") class RootElement { to create xml file from java, it creates the root element as: <ns2:RootElement xmlns:ns2="namespace"> but I wanted to create without the "ns2", like: <RootElement xmlns="namespace"> Any idea how to fix it? Reletad link (example I used to create the xml): http://www.java2s.com/Code/JavaAPI/javax.xml.bind.annotation/XmlRootElementname.htm

    Read the article

  • Pair attribute naming in custom configSections

    - by fearofawhackplanet
    I'm trying to store a user list in a config file. I've been looking at DictionarySectionHandler and NameValueSectionHandler. I'm not too sure what the difference between these two is, but anyway, neither of them do exactly what I'd like. You can add a custom config section like so: <configSections> <section name="userAges" type="System.Configuration.DictionarySectionHandler"/> </configSections> <userAges> <add key="userName1" value="10" /> <add key="userName2" value="52" /> <userAges> Which is ok, but actually I'd prefer to be able to write: ... <userAges> <add user="userName1" age="10" /> <add user="userName2" age="52" /> <userAges> Which I feel would make the config file clearer to anyone who needed to add/remove users in future. Is there an easy way to do this?

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >