You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rahul Ranjan <ra...@gmail.com> on 2019/04/24 12:52:53 UTC

Problem in ApacheTomcat - 8.0. 37: Files are not displaying in sorted order.

 Hi Team,

I am facing an issue which is related to ApacheTomcat-8.0.37. I wrote a
code to display the files/folder in browser. By default it should display
in alphabetically sorted order. But it's not showing.
I have migrated my code from Unix to Linux. In Unix system my code was
working fine. Can you please tell me what could be the problem?

I am attaching you a screenshot for reference. I will appreciate any help.
[image: image.png]
*Regards,*

[image: Lucida Technologies]

RAHUL RANJAN
C++ Developer | IBM
Mob   : 9570311276
Skype: rahulranjan.cusb@gmail.com
[image: facebook] <https://www.facebook.com/rahulranjancusb/>
[image: linkedin] <https://www.linkedin.com/in/rahulranjancusb/>

Re: Problem in ApacheTomcat - 8.0. 37: Files are not displaying in sorted order.

Posted by Olaf Kock <to...@olafkock.de>.
On 24.04.19 14:52, Rahul Ranjan wrote:
> Hi Team,
>
> I am facing an issue which is related to ApacheTomcat-8.0.37. I wrote
> a code to display the files/folder in browser. By default it should
> display in alphabetically sorted order. But it's not showing.
> I have migrated my code from Unix to Linux. In Unix system my code was
> working fine. Can you please tell me what could be the problem? 
>
> I am attaching you a screenshot for reference. I will appreciate any
> help.

Note: Attachments are stripped by the mailing list software

As you're asking for code that's not related to tomcat (just happens to
run on it), I'd expect a place like stackoverflow.com to be a better
place for getting debugging help. But either way, here or there: If you
expect anyone to help you debugging your code, you'll need to provide
it. I'm assuming that you didn't attach your code as an image (because
why would you turn perfectly valid characters into a pixellated image?).

Olaf



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem in ApacheTomcat - 8.0. 37: Files are not displaying in sorted order.

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
Hi.

1) this list strips most attachments. If you want to post an image, upload it to some 
shared site, and provide a link to it.
2) look at the Tomcat logfiles (usually in the directory {tomcat installation 
directory}/logs). If there is an error, it is certain that something in the logfile will 
tell you. If you do not understand what it says in the logfile, copy-and-paste the 
relevant portion here and ask for help.
3) you seem to imply that the code which displays the list of files, is part of a webapp 
which you wrote yourself.  Someone here /may/ be able (and willing) to help you debugging 
it, but not without actually seeing that code.
4) if all you want to do, is to allow the display of the list the files present in a 
directory, in alphabetical order, then you do not need special code to do that.  The 
standard "default servlet" already does that for you, if it is set up correctly.

Example :
- create a directory under tomcat/webapps, named "listfiles"
- put some files there (under tomcat/webapps/listfiles/)
- create a subdirectory tomcat/webapps/listfiles/WEB-INF
- in that sub-directory, create a text file "web.xml" with this content :
--begin--
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                       http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
   version="3.1"
   metadata-complete="true">

     <description>
       directory list example
     </description>
     <display-name>directory list example</display-name>

     <servlet>
         <servlet-name>default</servlet-name>
         <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
         <init-param>
             <param-name>listings</param-name>
             <param-value>true</param-value>
         </init-param>
     </servlet>

     <servlet-mapping>
         <servlet-name>default</servlet-name>
         <url-pattern>/*</url-pattern>
     </servlet-mapping>

</web-app>
--end--

(omit the begin/end lines)
- make sure that all the above is accessible to the user-id which runs tomcat (under 
Linux, that should be "tomcat8")
- restart tomcat
- access the URL : http://(yourserver):8080 (or your tomcat listening port)/listfiles

There probably exists an even simpler way to do the above, but that's the first thing that 
I could think of.


On 24.04.2019 14:52, Rahul Ranjan wrote:
>   Hi Team,
>
> I am facing an issue which is related to ApacheTomcat-8.0.37. I wrote a
> code to display the files/folder in browser. By default it should display
> in alphabetically sorted order. But it's not showing.
> I have migrated my code from Unix to Linux. In Unix system my code was
> working fine. Can you please tell me what could be the problem?
>
> I am attaching you a screenshot for reference. I will appreciate any help.
> [image: image.png]
> *Regards,*
>
> [image: Lucida Technologies]
>
> RAHUL RANJAN
> C++ Developer | IBM
> Mob   : 9570311276
> Skype: rahulranjan.cusb@gmail.com
> [image: facebook] <https://www.facebook.com/rahulranjancusb/>
> [image: linkedin] <https://www.linkedin.com/in/rahulranjancusb/>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org