Writing JSP page and calling methods
Hello Everyone,
I'm new to java and got stuck in writing a jsp file for deploying a we app in java.
public void doReadWriteTextFile() {
String inLine = null;
StringBuffer SB = new StringBuffer();
boolean AccessionNumFound = false;
boolean SeqFound = false;
try {
BufferedReader inputStream = new BufferedReader(new
FileReader(inputFastaFleName));
while ((inLine = inputStream.readLine()) != null &&AccessionNumFound == false)
{
String acN = inLine.substring(0);
int StartPosition =acN.indexOf(">");
int EndPosition = acN.indexOf(" ");
if (StartPosition == -1 || EndPosition == -1)
{}
else
{
String accessionNumber = acN.substring(StartPosition + 1, EndPosition);
if (accessionNumber.compareTo(inputAccNumber) == 0
{
boolean NextSeqCheck = false;
System.out.println("Accession numbers matched");
System.out.println(inLine);
AccessionNumFound = true;
while ((inLine = inputStream.readLine()) != null && NextSeqCheck == false)
{
if (inLine.startsWith(">") == true)
{
NextSeqCheck = true;
}
else
{
// set a flag for future use/for rest of the processing...
SeqFound = true;
CntSequenceLines++;
SB.append(inLine);
}
}//end while+
}
}
} //end while
inputStream.close();
ProteinSequence = new String(SB);
}
catch (IOException e) {
System.out.println("IOException:");
e.printStackTrace();
}
}
public void CoverageCalculator() {
int Length =0;
String X;
for (int idx=0; idx < seqSearch.length; idx++) {
X = (seqSearch[idx]);
int startIndex = ProteinSequence.indexOf(X)+ 1;
Length = X.length();
int endIndex = Length + startIndex -1;
if(startIndex > 0){
System.out.println("Sequence: " + X +", " + " Sequence Position:" + startIndex + "-" + endIndex +", " + " Sequence Length: " + Length);
seqSearchLength = seqSearchLength + Length ;
}
else{
System.out.println("Did not find string " + seqSearch[idx]);
}
}
sequenceLength = ProteinSequence.length();
CoverageArea = (double)seqSearchLength /sequenceLength;
}
I want to call the two methods doReadWriteTextFile() andCoverageCalculator() in a jsp page.
I have written like
<%@ page import ="SequenceEditor.Core" %>
Core SeqEd = new Core();
String inputAccNumber = "UniRef100_Q3BW44";
String inputFastaFleName = "C:\\database\\unimouse-1205.fasta";
%>
<%=SeqEd.doReadWriteTextFile() %>
<%=SeqEd.CoverageCalculator() %>
but it's not working. Any help would be appreciated

