• Post Reply Bookmark Topic Watch Topic
  • New Topic

A question of "  RSS feed

 
Frog Killer
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a String temp="string"test" in database ;
<%=request.getParameter("temp")%> in Jsp page;
but as a result show: "string" ;
Could you help me find the lost string of "test ?
 
Mark Stein
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you've got too many/mismatched quotes. "string" is in quotes, and you have test in an open quote with no closing ("test). And why do you even have "string" on the right side of your equation? It should either be "string"+"test", or maybe you want to cast it.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"FrogKiller",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
 
Frog Killer
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry! maybe it let you can see much more.
string"test is a full string in database;
<%String temp = query.getSting(3);%>
//query is a result gather from database
//3 is a row value;
now this String is : string"test;
but use <%=temp%> in Jsp page only see : string ;
Can you help me show the full string on Jsp page?
ADD: this problem is OK!
Thanks all!
[ August 28, 2002: Message edited by: Frog Killer ]
 
Shashi Kanta
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think u r talking about assigning a JSP variable value to a form field.
if that's the case, use like this
value='<%=temp%>'
// here value is a value attribute of the field
u can use URLEncoder also to pass form values in their original format e.g. containing qoutes etc.
hope u got what u want.
Shashi
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frog Killer,
That is obviously a fictious name as defined in our Naming Policy Please read and follow the policy!

Thanks.
As to your question if a " is part of your string, you need to escape it!
String temp="string\"test";
Several characters need to be escaped if part of a String in Java!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!