Results 1 to 7 of 7

Thread: GET request problem in Java Struts

  1. #1
    Join Date
    Mar 2010
    Posts
    330

    GET request problem in Java Struts

    Hello,
    I have a big worry. I have the link:
    <bean:define id="myBeanValue" name="myBean" property="myProperty" />
    <html:link href="test.do?prop='1'" />
    How should we manage file test.do? I have no idea how to do this, if you can help me with this it would be great. Thank you.

  2. #2
    Join Date
    Dec 2009
    Posts
    292

    Re: GET request problem in Java Struts

    I have not done struts 1 but I have done with strut 2. But it struts mapping path http -> Java class (Struts Action). If you explained your problem more in details it would be easy to rectify the problem here. So, please provide more information of you java file and others.

  3. #3
    Join Date
    Mar 2010
    Posts
    330

    Re: GET request problem in Java Struts

    I have a "table" with the kind of links <html?#51;link href="test.do?id='1'" /> with the id number that changes with the line The principle is that I have to deal with this id parameter in question in a code. This code must retrieve this parameter and use it to make an application in a database and display the result. The button should appear to confirm the order.

    My current problem is that:
    - The link is normally good
    - I just can not understand what they ought to be put in the file. Do, even if I saw that he had the possibility of dismissal of the application. To do a temp.java via struts-config.xml

  4. #4
    Join Date
    Nov 2009
    Posts
    356

    Re: GET request problem in Java Struts

    Here a sample code, if you need you can check it out

    Code:
    import java.io. *; 
    import javax.servlet .*; 
    import javax.servlet.http .*; 
    
    / ** Creates a new instance of gspnr * / 
    public class gspnr extends HttpServlet 
    (public void doGet (HttpServletRequest req, HttpServletResponse res) 
    throws ServletException, IOException 
    (String pr = req.getParameter ("pr");))

  5. #5
    Join Date
    Sep 2009
    Posts
    125

    Re: GET request problem in Java Struts

    If we consider the relationship that I've done:
    <html?#52;link href="test.do?prop='1'" />
    There is indeed a file test.do, so somewhere there must exist. By cons I do not know if it exists as a file or just as a line in the struts-config.xml (or elsewhere) in your case how does it work? This would be something like this?:
    Code:
    <servlet-mapping>
    <servlet-name> action </ servlet-name>
    <url-pattern> *. do </ url-pattern>
    </ Servlet-mapping>

  6. #6
    Join Date
    Dec 2009
    Posts
    213

    Re: GET request problem in Java Struts

    Nameless is right: With Struts, your only Servlet Struts is the Controller. What you have to do is to define its behavior (SN The mapping mentioned, usually struts-config.xml, for which you are going to match url and class-action treatment). It must obviously be defined before (web.xml) that takes into account your servlet struts (usually. C)

  7. #7
    Join Date
    Mar 2010
    Posts
    372

    Re: GET request problem in Java Struts

    There's something I do not understand, it is an action ok, they say that it s called the file or the path
    type = GestionPanier.java -> wholesale used for this file in my case the application
    <forward name="redirection" path="/panier.jsp" /> -> and after using GestionPanier.java, it is returned to the page panier.jsp with displaying the result of the application

Similar Threads

  1. Replies: 4
    Last Post: 11-01-2014, 10:14 AM
  2. Sending a POST Request in Java
    By Sheenas in forum Software Development
    Replies: 4
    Last Post: 26-02-2010, 10:52 PM
  3. Send Http Request In Java
    By ramsun in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 09:55 PM
  4. Sending SOAP Request in java
    By samualres in forum Software Development
    Replies: 5
    Last Post: 09-02-2010, 06:55 PM
  5. Replies: 3
    Last Post: 10-05-2007, 11:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,121,072.66325 seconds with 17 queries