Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

filename, directory name, or volume label syntax is incorrect error in the try catch  RSS feed

 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir when i am getting the value from properties file the
the path showing http://127.0.0.1:81/help/Subject of Issue.txt which is right.
But in jsp in try block when pass SubjectofIssue path that time it is
showing SubjectofIssue););//http:\127.0.0.1:81\help\Subject of Issue.txt

So the error comming in jsp page.

Please look at my error log.
SubjectofIssue http://127.0.0.1:81/help/Subject of Issue.txt
stdout: exception in getting connectionhttp:\127.0.0.1:81\help\Subject of Issue.txt (The filename, directory name, or volume label syntax is incorrect)



Could you please tell me the reason why such an error i am geting in jsp inside the tryblock.

Thanks in Advance.
Regards
Sumanta

ItsPropertiesNT.properties
---------------------------
SubjectofIssue=http://127.0.0.1:81/help/Subject of Issue.txt

x.jsp
--------------------------
<%
String SubjectofIssue = null;
ResourceBundle bundle = null;
if(Config.serverType != null && "NT".equals(Config.serverType))
{
bundle = PropertyResourceBundle.getBundle("ItsPropertiesNT");

}

if(bundle != null)
{
SubjectofIssue = bundle.getString("SubjectofIssue");
out.println(SubjectofIssue="+SubjectofIssue);//http://127.0.0.1:81/help/Subject of Issue.txt
}

%>
<%
try{
System.out.println("SubjectofIssue"+SubjectofIssue);//http:\127.0.0.1:81\help\Subject of Issue.txt
String theBR;
File fin=new File(SubjectofIssue);
FileReader fr=new FileReader(fin);
BufferedReader br=new BufferedReader(fr);
theBR=br.readLine();
String[] theSplit=theBR.split(",");
for(int i=0;i<theSplit.length;i++)
out.print("<option value=\"" + theSplit[i] +
"\">" + theSplit[i] + "</option>");
// out.print("</select>");

}catch(Exception Ex){
System.out.println("exception in getting connection"+Ex.getMessage());
}
%>

 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
Please advise me for the needful.

Regards
Sumanta
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll give the same advice I always give: at this point you should no longer be placing Java code into JSP pages. Factor the code out into Java classes where it belongs and where Java errors are much easier to deal with
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File fin=new File(SubjectofIssue);

Why are you trying to make an HTTP URL into a File object? That doesn't make any sense.
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear paulSir,
Could you please tell me instead of writting this File fin=new File(SubjectofIssue); how will i approch for it.

Thanks in Advance.

Regards
Sumanta
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use java.net.URLConnection.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!