• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP Forms Text box

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am running into this problem when I try to submit a form.
I enter value in a text box field(name) in the form (with white spaces) for eg Anu Iyer, and this form action is a jsp program which receives the parameter as follows:

String Name;
Name = request.getParamater("name");

When print the Name field in the JSP program I get only Anu. Everything after the white space is cut.

Form is submitted using POST.

Can you please help me?

Thanks
Anu Iyer
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's usually an indication of a quoting problem somewhere along the line. But we need to see your code to be sure.

Please post the relevant pieces of code, and please use the UBB code tags to preserve the code formatting (see the CODE button below the text entry area).
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you don't have quotes in your input field.


<input type="text" value=<jsp tag to print value> >

In which case the browser will only recognize the string that is directly up against the equals sign.






[KLUNK!]
[ November 03, 2005: Message edited by: Ben Souther ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[KLUNK!]



We really need to come up with a "head-bumpers" smilie!
 
Anu Iyer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Heres the code:

Form (HTML code)

<form METHOD=GET NAME="cdms" onSubmit="return checkForm();" action="submit_work_request.jsp">
.
.
.
<tr bgcolor="SILVER">
<td valign=top>
<input type="text" name="title" value="" size=15 maxlength=20></td>
<td valign=top>
<b>Title</b>
<br>

Submit_work_requst.jsp
<%@ page import="java.util.*" %>

<%@ page import="java.sql.*" %>

<%@include file="header.jsp"%>
<BR>
<HEAD>
<%! String wr_nbr, development_team_lead, title, priority, description, business_approver; %>
<%
wr_nbr = request.getParameter("wr_nbr");
development_team_lead = request.getParameter("development_team_lead");
priority = request.getParameter("priority");
business_approver = request.getParameter("business_approver");
title = request.getParameter("title");
description = request.getParameter("description");
%>
 
Anu Iyer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<form METHOD=POST NAME="cdms" onSubmit="return checkForm();" action="submit_work_request.jsp">

This is what I tried not GET method.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, in



get used to quoting all values. So it should be



Getting into this habit will save you heart-ache and pain in the future.

Secondly, you didn't show us how you are displaying the value.

Thirdly, please surround your code with UBB code tags. For example:

[CODE]
Here is where the code goes.
[/CODE]

This will help it stand out and will preserve its formatting.
[ November 03, 2005: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<%! String wr_nbr, development_team_lead, title, priority, description, business_approver; %>



This is going to cause you a lot of headaches as well.
Any variables declared inside a <%! %> block are instance variables.
They are shared among all requests to that JSP and are, thus, not thread-safe.
 
Anu Iyer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Thank you much. Yes, I quoted the values and I also removed the ! in the String Declare. It works perfect now.

Thanks!!!
 
It's feeding time! Give me the food you were going to give to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic