wood burning stoves 2.0*
The moose likes JSP and the fly likes String search! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

String search!

Sridhar Srinivasan
Ranch Hand

Joined: Nov 07, 2003
Posts: 117
I need to get the values of the all the names in the following string.
str1="<P>fasfa     <INPUT id=1 maxLength=22 size=22 value=dfsd name=fdss oth="d"></P>
<P>rdrgfdg  <INPUT id=1 maxLength=33 size=33 value=fgdf name=fdgd oth="d"></P>
<P>dfgdfg <INPUT id=1 maxLength=33 size=33 value=dgdf name=dgf oth="d"></P>
<P>fdgdfgd     <INPUT id=1 maxLength=33 size=33 value=dfgd name=dsgdf oth="d"></P>"
All the four text boxes are in the same format and I am using the following code to get the values of "name".But I am getting 3 values and 1 value is missing.Can anybody help me to solve this?My code is as follows:
while(str1.indexOf("name=",index) !=-1)
index = str1.indexOf("name=",index);

str1 = str1.substring(index);
String nm = str1.substring(5,str1.indexOf(" "));%><%=index%><br><%

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60785

I don't really see how this is substantially different than the question you asked here. Even that question seems to have more to do with String matching and manipulation than JSP, so I'll be moving it.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: String search!
Similar Threads
Value in dropdown from servlet
problem with java lib
error comes while connecting to database please see the source code and error for detail
Cache Problem in Jsp...
Need Help With Dynamic text box in JSP