Daniel Russell

Greenhorn
+ Follow
since Feb 04, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Daniel Russell

I'am trying to add a photo with Angular, but it gives me some errors.

It doesn't get the file name of the file input, he only get the description. So when I tempt to have the object, the object of the photo has only one property: the description; And naturally it doesn't add any photo.

this is the html file:




the part in AngularJs is this:




In the Servlet:




In the console it display this error:

Unable to process parts as no multi-part configuration has been provided

Ron McLeod wrote:You need to URL-encode your stringified JSON.  It will contain characters which are not permitted in a URI.



Thank you, now it works!
I have a problem, I have created a project for a social network. In a part of the project I'am using Angular routing to add, modify or delete  articles of the blog of the social media user. But the program do not add or modify the article, it can only delete it.

For example this is the page in which the user can write and add the article:



And this is the Angular file correlate, in which there are also all the function:



I do not understand if there are some problem with the "stringify", but the alert messagge is "something went wrong", so I assume that it gives me error, and in the console of Eclipse is displayed this error message:


java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986



Paul Clapham wrote:

Daniel Russell wrote:How can I update a jar?



You can't update a jar.

However I don't know what the context was that made you ask that. It's possible that you would accept "Just create the jar over again" as an answer -- but I can't tell.



It seems that I have solved the problem from my own, had only to eliminate a jar which gave me the problem, now the program can reach the page I wanted.
1 month ago

Knute Snortum wrote:I'm not sure exactly what it means because I don't know what "configure build path" is (in your IDE maybe?), but it seems like a good indication that the jar file has not been updated.


Yes, it's on my IDE, I'am using Eclipse for Java. How can I update a jar?
1 month ago

Knute Snortum wrote:I'm assuming you've restarted the server after changing the config.  Is there any possibility that the config info is still in the jar, or have you rebuilt that?



Yes, it is possible, I haven't changed any jar file. In fact when I go to "configure build path" there is a message near the servlet-api.jar and the message is:

/Sigil/C:/Users/Aula1_2/Dekstop/workspace/tomcat/lib (missing)



it means that there has to be a library with the new path?
1 month ago

Knute Snortum wrote:What's the full error message and stack trace?  Can you have the class log what path it is trying when it fails?


In the console it is not displayed any error. The only message is on the browser and it is this:

Template not found: C:\Users\Aula1_2\Desktop\workspace\Sigil\WebContent\WEB-INF\template\Door.html



He is trying to search the old directory and it doesn't find it, because, I have changed it to the new one, the one of Linux, wich is this:

 /home/dario/eclipse-workspace/Sigil/WebContent/WEB-INF/template/Door.html



this path is defined in the class Config.
1 month ago

Knute Snortum wrote:I don't see the connection between the classes Config and ViewHtml.  How is ViewHtml called?



There is an Interface wich ViewHtml implements, wich is IView:



then I use the view in the servlet, for example here:



And the fact is that the browser can not find the template, because he is still using the old path e non not the new one.

I have recently discovered that when I go to "configure build path" there is an error in servlet-api.jar, because he can not find obviously the old path, and he says that is missing.

1 month ago
I have imported a maven project that was previously in a computer with WIndows as OS and the project is now in Linux OS. So I had to change the directory of the templates. Now when I try to run the program, he says that he can not find the template path because he is still using the old one, even if I have changed it.

The error message is :

Template not found: C:\Users\Aula1_2\Desktop\workspace\Sigil\WebContent\WEB-INF\template\Door.html




I have defined the template url in Confing class:



Then I have used the template in a view class:



1 month ago

Rob Spoor wrote:

Daniel Russell wrote:Two Appweb? the folder and the name of the class?


Technically speaking the context path and the servlet path. (Note that I said the same except I used the term "war". That's how web applications are usually deployed.) But your servlet is mapped to /Appweb, not /Appweb/ or /Appweb/*. Try using http://localhost:8080/Appweb/Appweb (no trailing slash).

As for your error when you submit the form, that's because it's still trying to open http://localhost:8080/Appweb/. Unless you have an index.html, index.jsp or a welcome file in the root of your application, that URL simply does not exist.



Thank you! This is the solution! I have changed the url of the action="" to http://localhost:8080/Appweb/Appweb. Now it works.
5 months ago

Dave Tolls wrote:Right, based on the mappings in your web.xml, I would say your servlet resides at:
https://<servername>/Appweb/Appweb

The first Appweb is the application name (based on the folder name in webapps).
The second is what you have mapped the servlet to.

As for the message, it means the IDE cannot find either the source code or the Javadoc for those classes, and so cannot do it's usual trick of popping up the Javadoc description of the class.




Two Appweb? the folder and the name of the class?

When I open my hello.html, then I complete the form and I press 'submit', in the 404 error page the url written up the page is "http://localhost:8080/Appweb/". You mean the right url would be something like "http://localhost:8080/Appweb/Appweb/"? But even if I change to this, the error is the same.

the strange thing is that if I write http://localhost:8080/Appweb/hello.html, then it goes to the page with he form. When I press the button "submit" then it goes to the url http://localhost:8080/Appweb/  and then it show up the error message: "The origin server did not find a current representation for the target resource or is not willing to disclose that one exists."

5 months ago

Daniel Russell wrote:

Dave Tolls wrote:No, not your project.
What is deployed to tomcat?
What does the webapp folder under tomcat look like?

What you show there is your project, this is not the same thing that is deployed to the server.

If you don't know where to look, then how do you deploy your webapp?



You mean the folder in tomcat?

If so, it's this one:

wtpwebapps-

      Appweb-

        hello.html
       
        META-INF-
         
           MANIFEST.MF

        WEB-INF-
         
           web.xml

          classes-
         
                 helloservlets-
   
                     Appweb.class


          lib (empty)




I found another problem that likely is related to the 404 problem.

when I hover with the mouse those package:



I see this message: Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.

What's the meaning of this message?

My problem is related to get and post method, because the 404 appears when I click to submit button.
So there must be something to fix in HttpServletRequest.
5 months ago

Dave Tolls wrote:No, not your project.
What is deployed to tomcat?
What does the webapp folder under tomcat look like?

What you show there is your project, this is not the same thing that is deployed to the server.

If you don't know where to look, then how do you deploy your webapp?



You mean the folder in tomcat?

If so, it's this one:

wtpwebapps-

      Appweb-

        hello.html
       
        META-INF-
         
           MANIFEST.MF

        WEB-INF-
         
           web.xml

          classes-
         
                 helloservlets-
   
                     Appweb.class


          lib (empty)


5 months ago

Dave Tolls wrote:

Daniel Russell wrote:
If I go to WEB-INF/lib, in the lib folder there's nothing. If the servlet class is "helloservelets" in my case, then it has this directory: eclipse-workspace/Appweb/src/helloservlets. That is the directory in which I find the file Appweb.java. In web-inf there is only my web.xml. Does it means that I have to change the directory of helloservlets?



That sounds like it hasn't been deployed correctly.

Can you post the directory structure under your tomcat/webapps (not as a screenshot).

It should be something like:
webapp -
   Appweb -
       <html files>
       WEB-INF -
           classes -
               <your class directory structure helloservlet/Appweb.class>
           lib -  (probably empty)



My project has this structure:

Appweb- (folder of the project in workspace)

     build -
       classes-
          helloservlets-
                Appweb.class

     src-
         helloservlets-
           Appweb.java

     WebContent-
        hello.html

          META-INF-
             MANIFEST.MF
     
          WEB-INF-
             web.xml
             lib (empty)



So the class is in the build folder, not in the WEB-INF.
5 months ago

Rob Spoor wrote:

Daniel Russell wrote:The url in the browser is this one: http://localhost:8081/Appweb/.


That's missing the context path, which is the name of the WAR file (minus .war). Unless you deploy a WAR as the root application, you need to use its content path.



I'm not using a war file in my project, instead I'm using a web.xml and a hello.html. At the moment  I open the html file in the web browser, I complete the form and then, when I press the submit button, it appears the message: "The origin server did not find a current representation for the target resource or is not willing to disclose that one exists", in the error 404 page.

The Hello.html is this one:

5 months ago