File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

String search!

Sridhar Srinivasan
Ranch Hand

Joined: Nov 07, 2003
Posts: 117
Hi!
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><%
%><%="Name="+nm%>-<%
}
%>


Software_guy
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

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.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String search!
 
Similar Threads
Value in dropdown from servlet
problem with java lib
Cache Problem in Jsp...
error comes while connecting to database please see the source code and error for detail
Need Help With Dynamic text box in JSP