JSP :: How To Ignore Or Trim Directive Attribute With Space

Mar 17, 2014

I have the below code with spaces on uri and prefix (directive attribute).

<%@ taglib uri=" news.tld" prefix=" news" %>

how to fix without altering the JSP? Can i handle with web.xml or any other property available.

I have hundreds of jsp like this and wanted to handle without code fixes.

I tried JSP trimSpaces but it fixes the namespace but not the attributes.

View Replies


ADVERTISEMENT

JSP / JSTL :: Trim Whitespace Directive?

Jun 12, 2014

When using trim-directive-whitespaces in a Tomcat 7 application this expression also get trimmed:
 
<div class="${item.view} ${item.className}">
resulting in the HTML
<div class="personchild">
 
instead of
 
<div class="person child">
 
On the other hand, when I first assign the expression to a varibale it's fine:

<c:set var="className" value="${item.view} ${item.className}"/>
<div class="${className}">
 results in the desired HTML
 <div class="person child">
 
Is this the intention of the trim whitespace directive or does this look like a bug?

View Replies View Related

How To Ignore Numbers After Space

Feb 12, 2014

In c++, I'm aware that you can use the ignore function to ignore numbers after space, but in string how do I ignore a number after space is found for instance, "109 33" how would I ignore 33?

View Replies View Related

JSP :: Page Directive Attribute Session False - Yet Session Created

Feb 26, 2014

May be I did not understand the meaning and usage of attribute "session" in page directive. My understanding is if session=false, in page directive, then the JSP page will not participate in the session. However, I have my welcomepage as below:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
........
.......
<%= session %>
<c:out value="${pageContext.request.session}"/>

if I choose session=true, then both ways of accessing session works , which means the JSP page participated in the session.

But if I change the session=false, then <%= session %> fails, but <c:out value="${pageContext.request.session}"/> does not fail.

how can c:out still show the session, when session = false

View Replies View Related

JSP :: Adding Scriptlet In Directive

Sep 21, 2014

<jsp:directive.include file='<%= session.getAttribute("htmlPath").toString(); %>' / I tried to add a Scriptlet in a jsp directive like above. But am keep getting the below error.

HTTP Status 500 - /parseXML.jsp (line: 86, column: 1) File "<%= session.getAttribute("htmlPath").toString(); %>" not found

type Exception report message /parseXML.jsp (line: 86, column: 1) File "<%= session.getAttribute("htmlPath").toString(); %>" not found description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /parseXML.jsp (line: 86, column: 1) File "<%= session.getAttribute("htmlPath").toString(); %>" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133)
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:322)
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:357)
org.apache.jasper.compiler.Parser.parseXMLDirective(Parser.java:533)
org.apache.jasper.compiler.Parser.parseFileDirectives(Parser.java:1764)
org.apache.jasper.compiler.Parser.parse(Parser.java:135)

[code]....

View Replies View Related

Ignore Certain Characters In A String

Apr 5, 2014

I'm trying to loop through a string and depending on the character, add a JLabel to a game. The problem is the character 'L' represents a lantern but is also used in the reply the game gives which is "LOOKREPLY". I've tried to use some code to ignore the LOOKREPLY bit but it's not working. Here's what I've tried.

else if(message.charAt(i) == 'L' && message.charAt(i+1) != 'O' | message.charAt(i+1) == 'Y'){
JLabel localLabel = new JLabel();
localLabel.setIcon(lantern);
panel.add(localLabel);
panel.revalidate();
panel.repaint();

But the first image on all of the JLabels is always a lantern, which is what L represents. As it's only 1 lantern this leads me to believe that it's ignoring the first 'L' but for some reason it's not ignoring the 'L' at the end of LOOKREPLY.

View Replies View Related

How To Ignore Lowercase And Uppercase Letters

Oct 18, 2014

I have made a program, where the user types in a letter M, C or I to identify their major, if the user types m, c or i, my code does not work.

How could I make my program ignore if the letter is upercase or lowercase? My code is posted below. Can I do this in any easier way then adding this type of code for each lowercase letter?:

Java Code:

if (s.charAt(0) == 'm')
System.out.print("Mathematics "); mh_sh_highlight_all('java');

My current code:

import java.util.Scanner;
public class c4e18 {
public static void main(String[]args){
Scanner input = new Scanner(System.in);
System.out.print("Enter two characters: ");
String s = input.nextLine();
if (s.charAt(0) == 'M')

[Code] .....

View Replies View Related

Trim In StringBuilder And String?

Feb 1, 2015

I have a question about an exercise of OraclePress.

public class OompahLoompah {
public static void main(String[] ar){
final StringBuilder str = new StringBuilder("I good! ");
str.insert(2, "look ").append("and nice");
str.insert(str.length(), "!!!");
str.delete(str.length() - 2, str.length());
System.out.println(str.toString().trim());
}
}

The correct output is "I look good! and nice!" , but i don't understand for what .

Why the trim () method does not work? Whether is working on an object String.

View Replies View Related

Trim Spaces Between Words

Feb 4, 2014

How can i make sure that when user enter value there is no space between words example :

NEW  YORK MUST BE NEW YORK

View Replies View Related

Letter Count - Ignore All Numbers Or Punctuation Marks

Nov 13, 2014

I'm trying to make a program that will count each letter like if I put the word

e-1
h-1
l-2
o-1

The problem I'm running into is that if I put something like How now, brown cow? It should give me something like this

b - 1
c - 1
h - 1
n - 2
o - 4
r - 1
w - 4

but it doesn't instead the whole program crashes because of the punctuation marks and the spacing. Is there a way for me to fix that? All I know is that it has something to do with the alphabet[pos(letter)]++;

import java.util.Scanner;

public class CharCount {
static Scanner keyboard = new Scanner(System.in);
//this method should allow the user to enter a line of text (that should all be lower case) and then go to the printResults method
public static void main(String[] args) {
String text, character;
int count;
char letter;
int[] alphabet;
System.out.println("Enter a line of text:");
text = keyboard.nextLine().toLowerCase();// any text entered will be lower case
alphabet=countLetters(text);

[code]....

View Replies View Related

How To Trim Leading Zeros In Array Of Digits

Feb 4, 2015

I have an array made that represents digits and I am trying to make a method so that if there are zeros in front of the first significant digit I want to trim them, I understand you can't re size arrays so I have created a new array, but my code doesn't seem to run correctly? Here is my code I can't figure out what is wrong I've tried everything: (I put stars around the error**)

package music;
import java.util.Random;
public class Music {
private int length; // length of the array
private int numOfDigits; // number of actual digits in the array
int[] musicArray;

[Code] .......

View Replies View Related

JavaFX 2.0 :: VBox Scrollable - No More Buttons Ignore Swipe Gestures?

Jan 28, 2015

I have several Buttons wrapped into a VBox. I used setOnSwipeUp and setOnSwipeDown for up and downs the buttons. But when there is no more buttons the scroller continues but shows nothing, is empty. How do I do when there are no more buttons ignore swipe gestures?
 
[Java] // Menu Swipe Up menubox.setOnSwipeUp(new EventHandler<SwipeEvent>() {

View Replies View Related

Postal Code In Database - Leading Zeros Been Trim

Jun 10, 2014

I got situation where i have postal code as 0009 in database and the use is entering 0009 but somehow in my java code it only reading 9 from the xml file
 
This is how i define getter and setter :
 
When I debug the code i get this :

passed postalcode 9
 
if a user entered 0009 I what it to remain 0009
 
Java Code:

public String Postalcode="";  
public void setPostalcode(String Postalcode) { this.Postalcode = Postalcode; } 
public String getPostalcode() { return Postalcode; }

View Replies View Related

Enterprise JavaBeans :: JPQL Does TRIM Column Containing Only Blank Spaces Returns Null?

Oct 6, 2014

In Oracle SQL, when you do trim(column_name), if column_name is blank spaces only (say datatype is CHAR(8)), then "trim(column_name) is null" is true.
 
In JPQL, if you do "TRIM ( BOTH FROM p.column_name ) is null", does it evaluate to true just like in Oracle SQL?
 
The reason I'm asking, is my colleague wrote some code in JPQL like below:

... TRIM ( BOTH FROM CONCAT(p.column_name, '#@') ) = '#@'

He said he originally wanted to compare the TRIM result to empty String '', but the result is false, so he concat the column to some junk.

So if after the TRIM, the result is the same junk he added, then the column contains only blanks. I think this works but there could a simpler way to do it.

View Replies View Related

JSP :: Attribute Invalid For Tag According To TLD

May 6, 2014

My project in eclipse..I get the error below when I run MyTagUser.jsp -

HTTP Status 500 - /jsp/MyTagUser.jsp(14,0) Attribute subTitle invalid for tag Header according to TLD
org.apache.jasper.JasperException: /jsp/MyTagUser.jsp(14,0) Attribute subTitle
invalid for tag Header according to TLD
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)...et

[code]...

View Replies View Related

JSF :: Saving A Session Attribute?

Mar 13, 2014

How can I store in database an user Session attribute along with other informations provided in the same form?

<p:outputLabel value="user ID:" for="informer" />
<p:inputText id="informer" value="#{session.getAttribute('userID').toString()}"
title="informer" disabled="true" />

I've already tested with disabled="false", too, but only the Session attribute is saved as NULL, though it appears in the form field. The other fields are saved properly.

View Replies View Related

JSF :: Set Attribute Type Dynamically

Oct 22, 2014

context.getELContext().getELResolver().getType(context.getELContext(), null, "value")

Here "value" is an attribute name. By this we can get data type of the attribute.

By somehow can we set the type also?

View Replies View Related

How To Read Integer Attribute Using DOM Element

May 13, 2014

I don't know how to read the attribute maxLenth. The way in the image I have done drive me to the error below.!

Piece of XSL:

<?xml version="1.0" encoding="UTF-8"?>
<c:message xmlns:c="ictt"><c:de format="B" lengthField="0" name="BIT MAP, PRIMARY" number="000"/>
<c:de format="B" lengthField="0" maxLength="008" minLength="008" name="BIT MAP, SECONDARY" number="001" subFields="00"/>

Piece of Java Code:

int length = Integer.parseInt(spec.getAttribute("maxLength"));
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R java.lang.NumberFormatException: For input string: ""
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R at java.lang.NumberFormatException.forInputString(Num berFormatException.java:63)
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R at java.lang.Integer.parseInt(Integer.java:502)
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R at java.lang.Integer.parseInt(Integer.java:531)

maxlenth.jpg

View Replies View Related

JSP :: Can't Get Local Variable Value In Value Attribute Of Input Tag

Feb 3, 2014

Here, I have just tried out to take a value from the database and storing it into local variable then I want to have that value in the value attribute of <input> tag but somehow, I can't get it..

Here, below is my code..

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL]....">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

[Code]...

View Replies View Related

Servlets :: Cannot Serialize Session Attribute

Jan 11, 2015

I am getting following exception.

Jan 11, 2015 10:08:23 PM org.apache.catalina.session.StandardSession writeObject
WARNING: Cannot serialize session attribute cart for session 2F9FF7A5ABC3620BD5B3BC0C4D46C558
java.io.NotSerializableException: org.apache.tomcat.jdbc.pool.DisposableConnectionFacade
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)

[Code] .....

View Replies View Related

JRE :: Java DeploymentRuleSet - Force Attribute

Oct 27, 2014

We've implemented the Whitelist and there's an application I need to use the Force attribute with, however, I'm unable to get this to work.  As I read it, this code says use Java 1.6_24 for Example.com and any other applications are blocked from running.  There are three versions of Java installed - 1.6_24, 1.7_65 & 1.8_25.  The Java console shows 1.8_25 being called.
 
Here's the ruleset.
 
<ruleset version="1.1+">  <rule>    <id location=https://example.com />   
<action permission="run" version="1.6_24" force="true" />  </rule>
<rule>    <id />    <action permission="block">     
<message> This application is blocked due to Java restrictions, please contact the Service Desk for assistance.</message> </action>  </rule></ruleset>
 
I also tried

<action force="true" permission="run" version="1.6.0_24" />
and also
<action force="true" version="1.6.0_24" permission="run" />. 

The Java console is still showing version 1.8.0_25.

View Replies View Related

Servlets :: Determine Which HttpSession Attribute Value Changed?

Feb 15, 2015

I'm looking to figure out if it's possible to do the following:

HttpSession session = request.getSession();
session.setAttribute('name', 'Jane_Doe');
// more code here
session.setAttribute('name', 'John_Doe');

Obviously, you can use the HttpSessionAttributeListener to determine which attribute has changed. However, it doesn't return the new value but rather the old one.

You can use the HttpSessionEvent listener to determine when a session object has been changed.

Is there a way you can determine when a session object changes (and it does NOT occur when the setAttribute method is called...) and determine the updated key:value pair?

View Replies View Related

JSF :: How To Change Rows Attribute Of InputTextarea Dynamically

Feb 13, 2014

i have a field that varies from 10 to 3000 VARCHAR in DB. A field called IDTEXT in a database that can be even a single word or up to a max of 3000. I want to display that in a form. Based on its size i want to very the size of the <h:inputTextarea>. How can i do it..will i be able to set row property from bean?

View Replies View Related

Servlets :: Session Attribute Keeps Reverting To Declared Value

Dec 29, 2014

Being new to java I am a bit lost as to why my session attribute for this banking app wont add the deposits to the session var... it just keeps going back to the amount I set it to originally - so if I set the beginning balance to 3000 then deposit 100 it becomes 3100, but if I then try deposit another amount eg. a extra 200 it becomes 3200 not 3300 like it should be !!

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.text.DecimalFormat;
public class SessionBank extends HttpServlet

[Code] .....

View Replies View Related

Make Session Attribute To Store New Value After Calculation?

Dec 29, 2014

why my session attribute for this banking webapp wont add the deposits to the session var... it just keeps going back to the amount I set it to originally - so if I set the beginning balance to 3000 then deposit 100 it becomes 3100, but if I then try deposit another amount eg. a extra 200 it becomes 3200 not 3300 like it should be !!

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.text.DecimalFormat;

[code]....

View Replies View Related

Servlets :: How To Get Attribute From Session In Regular Java Class

May 21, 2014

i have file index.jsp , that approach to reguar java class and call function . in that function i want to get attribute from session like this :

List<Coupon> couponsList = (List<Coupon>)request.getSession().getAttribute("listOfCouponsThatNotExpired");

because this regular java class i get error message ,how to solve this ?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved