What you're trying to do wont work. In your original attempt, you had a JSP which invokes a bean, and the bean reads from the request. The request doesn't contain the HTML the JSP generates, so that wont give you what you wanted.

The code below also wont work. You're trying to read the HTML source of the page, but all you have to work with here is the form data submitted by that page. And again, reading from the request is not the way to get at it, even if that was the data you wanted.

Your objective, if I understand correctly, is:
a) generate an HTML page
b) read the generated page and analyze it

You will need to separate these. You can't do it all within a page. To achieve (b) you'll need to write a separate service that requests the page and then processes it. Or, better yet, use one of the many existing tools for performing the checks you want.

L.

Marcello Savino wrote:
Ok i've tryed the form submit too here the code:
Jsp:
<html:submit property="method"><bean:message key="bottone.readContent" 
/></html:submit>   

Action.Java:
public ActionForward readContent(
                ActionMapping mapping,
                ActionForm form,
                HttpServletRequest request,
                HttpServletResponse response)
                throws IOException, ServletException {
                        StringBuffer HTMLStr=new StringBuffer("");
                        try {
                        
                        BufferedReader br = request.getReader();
                        HTMLStr.append(br.readLine());
                        System.out.println (HTMLStr.toString());
                        return(mapping.getInputForward());      
                        
        }

The string HTMLStr.toString() return always null !

Marcello Savino
ALDEBRA S.p.A. tel. 0461302441

-----Messaggio originale-----
Da: Nagraj Rao [mailto:[EMAIL PROTECTED] Inviato: mercoledì 24 gennaio 2007 15.01
A: Struts Users Mailing List
Oggetto: Re: R: Reading generated html

Hi Marcello

i'm bit confused on whether you wanna submit the content or set it into an 
object. Please guide me on that.
i guess if you're capturing an HTML content in your jsp, which you need to 
submit, a simple form submit should work. In case you wanna set i to myObj 
object then u can make it thru a scriptlet that Abhishek suggested.

you can also go for an Ajax submit as well.

N

----- Original Message -----
From: "Marcello Savino" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Wednesday, January 24, 2007 6:59 PM
Subject: R: R: Reading generated html


Cause i need to submit the html content to a servlet to analyze the html code


Marcello Savino
ALDEBRA S.p.A.
tel.  0461302441

-----Messaggio originale-----
Da: Dave Newton [mailto:[EMAIL PROTECTED]
Inviato: mercoledì 24 gennaio 2007 14.24
A: Struts Users Mailing List
Oggetto: Re: R: Reading generated html

--- Marcello Savino wrote:
As you can see (value="<%=request%>") the data setted is jsp is not of
type string.
I'm pretty sure cause i use to pass the request object to an other
similar bean (with other purpose) and it works fine !

I didn't know you could do that (or I forgot; don't know which). I thought I thought <%= ... %> basically called toString on everything.

Now... *why* would you want to do this?! It strikes me as being a pretty Bad Idea.

Dave




____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to